DumontAPI Namespace Reference

Dumont API Namespace. More...


Classes

class  Application
 Commence Application object. More...
class  CategoryDef
 Category Definition. More...
class  Conversation
 Commence DDE Conversation. More...
class  Cursor
 Commence Cursor Object Wrapper. More...
class  Database
 Commence Database Wrapper. More...
class  Dumont
 Dumont. More...
class  FieldDef
 Category Definition. More...
class  RowSet
 RowSet. More...
class  Smtp
 SMTP Interface. More...
class  UserInfo
 User Information. More...

Enumerations

enum  GuidFormat {
  rawDataGuid, registryGuid, headerProtectGuid, oleCreateGuid,
  defGuid, staticGuid
}
 Guid Output Formats
. More...

Functions

QString appendString (const QString &initial, const QString &appendValue, const QString &delimiter)
 Append a String to a String with Delimiter.
QString cliptext (void)
 Get Clipboard Text.
void cliptext (const QString &value)
 Set Clipboard Text.
QString compress (const QString &data, int level)
 Compress a String.
QString compressHex (const QString &data, int level)
 Compress to HEX.
int crc16 (const QString &data)
 Generate a 16-bit CRC on some data.
int crc32 (const QString &data)
 Generate a 32-bit CRC on some data.
QString crc8String (const QString &in)
 Calulate a CRC8 on a string.
QString dateTimeStamp (const QString &delimiter)
 Time/Date with a delimiter.
QString dateTimeStamp (int length)
 Current Date/Time as a stamp.
QString dateTimeStamp (const QDateTime &dateTime, int length)
 Date/Time as a stamp.
QString delVar (const QString &varData, const QString &varField)
 Delete a var.
QString dq (const QString &string)
 Double quote a string.
void dumpString (const QString &string)
 Dump a String to the Debug Window.
QString fixCase (const QString &value)
 Fix Case.
QString fixPhone (const QString &value)
 Fix a Phone Number.
QString formatText (const QString &preText, const QString &text, const QString &postText)
 Format Text.
QString getVar (const QString &varData, const QString &varField, const QString &defaultValue)
 Get a var Value.
QString guid (GuidFormat format, bool ucase)
 Format a GUID value.
QString guid (const QString &id, GuidFormat format, bool ucase)
 Format a GUID value.
QString guid (const QUuid &id, GuidFormat format, bool ucase)
 Formatted GUID value.
QString guid ()
 Return a GUID value.
bool isFalse (const QString &yesNo)
 Test for Falseness.
bool isTrue (const QString &yesNo)
 Test for Trueness.
QString md5 (const QString &data)
 Generate an MD5 hash of data.
QString packDate (const QDate &date)
 Pack the Date//Time.
QString packDateTime (const QDate &date, const QTime &time)
 Pack Date Time.
QString packDateTime (const QDateTime &dateTime)
 Pack Date Time.
QString packTime (const QTime &i_time)
 Pack Time.
QString pad (const QString &string, const QString &padString, int length)
 Pad a String.
bool phoneTooShort ()
 Return if Phone is too short.
QString prepend (const QString &prep, const QString string, int count)
 Preceed a string with another string.
QString prependZero (const QString &string, int count)
 Prepend a String with Zeros.
QString setVar (const QString &varData, const QString &varField, const QString &newValue)
 Set a var value.
QString uncompress (const QString &data)
 Uncompress a String.
QString version ()
 Version Number.
QString YesNo (bool v)
 Return "Yes" or "No".


Detailed Description

Dumont API Namespace.

The DumontAPI is


Enumeration Type Documentation

enum GuidFormat

Guid Output Formats
.

Enumerator:
rawDataGuid 
  • 0 ~ "080b29a9175a4096b450b1ff11a7816c"
registryGuid 
  • 1 ~ "{080b29a9-175a-4096-b450-b1ff11a7816c}" (default)
headerProtectGuid 
  • 2 ~ "_080b29a9_175a_4096_b450_b1ff11a7816c"
oleCreateGuid 
  • 3 ~ "IMPLEMENT_OLECREATE(<<class>>, <<external_name>>, 0x080b29a9, 0x175a, 0x4096, 0xb4, 0x50, 0xb1, 0xff, 0x11, 0xa7, 0x81, 0x6c);"
defGuid 
  • 4 ~ "DEFINE_GUID(<<name>>, 0x080b29a9, 0x175a, 0x4096, 0xb4, 0x50, 0xb1, 0xff, 0x11, 0xa7, 0x81, 0x6c);"
staticGuid 
  • 5 ~ "static const GUID <<name>> = { 0x080b29a9, 0x175a, 0x4096, { 0xb4, 0x50, 0xb1, 0xff, 0x11, 0xa7, 0x81, 0x6c } };"

Definition at line 78 of file dumont.h.


Function Documentation

QString appendString ( const QString &  initial,
const QString &  appendValue,
const QString &  delimiter 
)

Append a String to a String with Delimiter.

This little program solves a particular issue with joining two strings together with a delimiter inbetween. The problem arises when building a delimited string when the initial value has not yet been set.

When the initial value is blank, then the appendValue is set to the string with no delimiter. This allows delimited strings to be quickly and easily built.

Typical vbScript implementation (undesired)
 Sub strap( ByRef inStr, ByVal sepVal, ByVal appVal )
   if( appVal <> "" And appVal <> "(none)" ) then
     if( inStr <> "" ) then
       inStr = inStr & sepVal & appVal
     else
       inStr = appVal
     end if
   end if
 End Sub
As you can see from the code above, appending a string to an existing string with a delimiter is not complicated, just messy. This procedure makes appending strings together much simpler.

Preferred method of appending two strings.
 myString = DumontAPI::appendString( myString, myValue, theDelimiter );
Parameters:
initial String ~ the initial string value (can be blank)
appendValue String ~ the value to be appended
delimiter String ~ the seperator to place between the strings

Definition at line 357 of file dumont.cpp.

QString cliptext ( void   ) 

Get Clipboard Text.

Definition at line 607 of file dumont.cpp.

void cliptext ( const QString &  value  ) 

Set Clipboard Text.

Definition at line 598 of file dumont.cpp.

QString compress ( const QString &  data,
int  level 
)

Compress a String.

Compresses the string and returns the compressed data in a new byte array.

The compressionLevel parameter specifies how much compression should be used. Valid values are between 0 and 9, with 9 corresponding to the greatest compression (i.e. smaller compressed data) at the cost of using a slower algorithm. Smaller values (8, 7, ..., 1) provide successively less compression at slightly faster speeds. The value 0 corresponds to no compression at all. The default value is -1, which specifies zlib's default compression.

See also:
uncompress

Definition at line 872 of file dumont.cpp.

QString DumontAPI::compressHex ( const QString &  data,
int  level 
)

Compress to HEX.

Definition at line 887 of file dumont.cpp.

int crc16 ( const QString &  data  ) 

Generate a 16-bit CRC on some data.

Definition at line 824 of file dumont.cpp.

int crc32 ( const QString &  data  ) 

Generate a 32-bit CRC on some data.

This does the same thing as the crc16 except it runs the crc on the data string twice, once in forward order and once in reverse order.

Definition at line 844 of file dumont.cpp.

QString crc8String ( const QString &  in  ) 

Calulate a CRC8 on a string.

This will generate an 8-bit CRC value against a string and return the result as a zero-prepended string.

Definition at line 284 of file dumont.cpp.

QString dateTimeStamp ( const QString &  delimiter  ) 

Time/Date with a delimiter.

Definition at line 472 of file dumont.cpp.

QString dateTimeStamp ( int  length  ) 

Current Date/Time as a stamp.

Definition at line 463 of file dumont.cpp.

QString dateTimeStamp ( const QDateTime &  dateTime,
int  length 
)

Date/Time as a stamp.

This returns a date and time as a stamp, with no punctuation.

Note:
The Length parameter is automatically limited to 0 - 17.

Definition at line 447 of file dumont.cpp.

QString delVar ( const QString &  varData,
const QString &  varField 
)

Delete a var.

This removes a varValue from a long string. In some cases it is preferrable to remove any reference to the varValue, and setting the value to "" results in a "varName=" field remaining in the varString.

Parameters:
varData string ~ var data in its complete form
varField string ~ the field that is to be return

Definition at line 131 of file dumont.cpp.

QString dq ( const QString &  string  ) 

Double quote a string.

This will place double-quotes around a string value.

Definition at line 221 of file dumont.cpp.

void dumpString ( const QString &  string  ) 

Dump a String to the Debug Window.

Definition at line 939 of file dumont.cpp.

QString fixCase ( const QString &  value  ) 

Fix Case.

Definition at line 713 of file dumont.cpp.

QString fixPhone ( const QString &  value  ) 

Fix a Phone Number.

Definition at line 734 of file dumont.cpp.

QString formatText ( const QString &  preText,
const QString &  text,
const QString &  postText 
)

Format Text.

Definition at line 702 of file dumont.cpp.

QString getVar ( const QString &  varData,
const QString &  varField,
const QString &  defaultValue 
)

Get a var Value.

This pulls a varValue from a long string. The string is assumed to have encoded \r\n (vbCrLf) characters seperating each line of varValue. The varValue fields contains the format varName=varValue common in most .ini files.

Parameters:
varData string ~ var data in its complete form
varField string ~ the field that is to be fetched
defaultValue string ~ the default value to be returned

Definition at line 68 of file dumont.cpp.

QString guid ( GuidFormat  format,
bool  ucase 
)

Format a GUID value.

Definition at line 589 of file dumont.cpp.

QString guid ( const QString &  id,
GuidFormat  format,
bool  ucase 
)

Format a GUID value.

Definition at line 580 of file dumont.cpp.

QString guid ( const QUuid &  id,
GuidFormat  format,
bool  ucase 
)

Formatted GUID value.

This formats a GUID value

Definition at line 521 of file dumont.cpp.

QString guid (  ) 

Return a GUID value.

Definition at line 491 of file dumont.cpp.

bool isFalse ( const QString &  yesNo  ) 

Test for Falseness.

This is a convenience function for isTrue().

See also:
isTrue

Definition at line 209 of file dumont.cpp.

bool isTrue ( const QString &  yesNo  ) 

Test for Trueness.

This takes a string parameter and determines if its value is true. This resolves several issues with the Commence database where depending on how a Checkbox data field is being accessed, the result will either be "T":"F" or "Y":"N" or "1":"0". These return codes are problemmatic since the programmer is left to either test/display for the return values or try to research what the result codes might be, simply to determine if a checkbox is checked or not.

Checkbox Result Codes
 form.connection("Relates to","Contact").fieldValue("isActive") == "0":"1"
 qrst.getRowValue(0,"Relates to Contact isActive")              == "T":"F"
Testing for Trueness or Checkedness
 if( isTrue(form.connection("Relates to","Contact").fieldValue("isActive")) )
 if( isTrue(qrst.getRowValue(0,"Relates to Contact isActive")) )
See also:
isFalse

Definition at line 188 of file dumont.cpp.

QString md5 ( const QString &  data  ) 

Generate an MD5 hash of data.

Definition at line 807 of file dumont.cpp.

QString packDate ( const QDate &  date  ) 

Pack the Date//Time.

This converts a QDateTime value into a packed field with no punctuation. This is intended for TimeDate stamping in category row items, and the punctuation is removed to reduce the possibility of processing errors and to standardize the format across system-wide regional time/date formatting settings.

Return values:
QString Packed DateTime value
 The format for the field is:
  YYYYMMDDHHNNSS
  +---+-+-+-+-+-
  |   | | | | |
  |   | | | | +-- seconds (prepend zero)
  |   | | | +---- minute (prepend zero)
  |   | | +------ hour (prepend zero)
  |   | +-------- day of month (prepend zero)
  |   +---------- month (prepend zero)
  +-------------- full (4 digit) year
Parameters:
date date ~ date in

Definition at line 638 of file dumont.cpp.

QString packDateTime ( const QDate &  date,
const QTime &  time 
)

Pack Date Time.

Definition at line 672 of file dumont.cpp.

QString packDateTime ( const QDateTime &  dateTime  ) 

Pack Date Time.

Definition at line 659 of file dumont.cpp.

QString packTime ( const QTime &  i_time  ) 

Pack Time.

Definition at line 650 of file dumont.cpp.

QString pad ( const QString &  string,
const QString &  padString,
int  length 
)

Pad a String.

This will pad a string with a string. It will return a new string set to the length requested.

Definition at line 307 of file dumont.cpp.

bool phoneTooShort (  ) 

Return if Phone is too short.

Definition at line 798 of file dumont.cpp.

QString prepend ( const QString &  prep,
const QString  string,
int  count 
)

Preceed a string with another string.

This will put a string at the beginning of another string. This function is usually used when it is desired to have a string that is prepended with zero's (0) or spaces. Therefore, generally, it is assumed that the prepending string is a single character.

See also:
prependZero
Parameters:
prep string ~ preceeding string
string string ~ current string value
count string ~ how long the resulting string should be

Definition at line 405 of file dumont.cpp.

QString prependZero ( const QString &  string,
int  count 
)

Prepend a String with Zeros.

Parameters:
string string ~ the string to be prepended
count integer ~ how long the resulting string should be

Definition at line 429 of file dumont.cpp.

QString setVar ( const QString &  varData,
const QString &  varField,
const QString &  newValue 
)

Set a var value.

This sets a varValue in a long string. The string will be coded with \r\n (vbCrLf) characters seperating each line of varValue. The varValue fields contains the format varName=varValue common in most .ini files.

Parameters:
varData string ~ var data in its complete form
varField string ~ the field that is to be fetched
newValue string ~ the new value to be applied

Definition at line 97 of file dumont.cpp.

QString uncompress ( const QString &  data  ) 

Uncompress a String.

This returns a string back to its original state after compression.

See also:
compress

Definition at line 900 of file dumont.cpp.

QString version (  ) 

Version Number.

Return the current version of Dumont.

Definition at line 920 of file dumont.cpp.

QString YesNo ( bool  v  ) 

Return "Yes" or "No".

This returns a string as "Yes" or "No" depending on the value of the boolean parameter.

Definition at line 157 of file dumont.cpp.





~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database Support User Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com