#include <CifFile.h>
Inherited by DdlFile.
Inheritance diagram for CifFile:
Public Types | |
enum | eQuoting { eSINGLE = 0, eDOUBLE } |
Public Member Functions | |
CifFile (const StringCompare::eCompareType caseSense=StringCompare::eCASE_SENSITIVE) | |
CifFile (const eFileMode fileMode, const string &fileName, const bool verbose=false, const StringCompare::eCompareType caseSense=StringCompare::eCASE_SENSITIVE, const unsigned int maxLineLength=STD_CIF_LINE_LENGTH, const string &nullValue=CifString::NullValue) | |
~CifFile () | |
bool | GetVerbose () |
void | SetSmartPrint (bool smartPrint=true) |
bool | IsSmartPrint () |
void | SetQuoting (eQuoting quoting) |
unsigned int | GetQuoting () |
void | Write (const string &cifFileName, const bool sortTables=false, const bool writeEmptyTables=false) |
void | Write (const string &cifFileName, const vector< string > &tableOrder, const bool writeEmptyTables=false) |
int | DataChecking (CifFile &dicRef) |
Static Public Member Functions | |
static void | GetItemNames (vector< string > &itemNames, ISTable &isTable) |
Static Public Attributes | |
static const unsigned int | STD_CIF_LINE_LENGTH = 80 |
Protected Types | |
enum | eIdentType { eNONE = 0, eLEFT, eRIGHT } |
Protected Member Functions | |
int | _IsQuotableText (const string &itemValue) |
eIdentType | _FindPrintType (const vector< string > &values) |
void | _PrintItemIdent (ostream &cifo, unsigned int &linePos) |
void | _PrintItemName (ostream &cifo, const string &category, const string &itemName, unsigned int &linePos) |
void | _PrintPostItemSeparator (ostream &cifo, unsigned int &linePos, const bool ident=false, const unsigned int numSpaces=1) |
int | _PrintItemValue (ostream &cifo, const string &itemValue, unsigned int &linePos, const eIdentType identType=eNONE, const unsigned int width=0) |
int | _PrintItemNameInHeader (ostream &cifo, const string &itemValue, unsigned int &linePos, const eIdentType identType=eNONE, const unsigned int width=0) |
void | _PrintHeaderedItems (ostream &cifo, const vector< string > &colNames, const vector< unsigned int > &colWidths, const vector< eIdentType > colPrintType) |
void | Write (ostream &cifo, const bool sortTables=false, const bool writeEmptyTables=false) |
void | Write (ostream &cifo, const vector< string > &catOrder, const bool writeEmptyTables=false) |
void | Write (ostream &cifo, vector< unsigned int > &tables, const bool writeEmptyTables=false) |
int | MandatoryCategoryChecking (CifFile &ref, ofstream &log) |
int | ItemsChecking (CifFile &ref, ofstream &log) |
Protected Attributes | |
unsigned int | _maxCifLineLength |
string | _nullValue |
bool | _verbose |
bool | _smartPrint |
string | _quotes |
Static Protected Attributes | |
static const unsigned int | STD_PRINT_SPACING = 3 |
static const unsigned int | SMART_PRINT_SPACING = 1 |
static const unsigned int | HEADER_SPACING = 40 |
Private Member Functions | |
void | Init () |
void | ConvertEscapedString (const string &inString, string &outString) |
This class represents a CIF file. In addition to inherited methods from TableFile class, this class provides methods for writing the data to a text file, along with methods for controlling how the data is written, and a method for verifying the CIF file against dictionary.
enum CifFile::eQuoting |
enum CifFile::eIdentType [protected] |
CifFile::CifFile | ( | const StringCompare::eCompareType | caseSense = StringCompare::eCASE_SENSITIVE |
) |
Constructs a CIF file.
[in] | caseSense | - optional parameter that indicates case sensitivity of table names. Possible values are case sensitive and case in-sensitive. If not specified, case sensitive table names are assumed. |
None |
CifFile::CifFile | ( | const eFileMode | fileMode, | |
const string & | fileName, | |||
const bool | verbose = false , |
|||
const StringCompare::eCompareType | caseSense = StringCompare::eCASE_SENSITIVE , |
|||
const unsigned int | maxLineLength = STD_CIF_LINE_LENGTH , |
|||
const string & | nullValue = CifString::NullValue | |||
) |
Constructs a CIF file.
[in] | fileMode | - CIF file mode. Possible values are read-only, create, update and virtual. Detailed description of file mode is given in TableFile documentation. |
[in] | fileName | - relative or absolute name of the file where object persistency is maintained. If fileMode specifies virtual mode, this parameter is ignored. |
[in] | verbose | - optional parameter that indicates whether logging should be turned on (if true) or off (if false). If verbose is not spefified, logging is turned off. |
[in] | caseSense | - optional parameter that indicates case sensitivity of table names. Possible values are case sensitive and case in-sensitive. If not specified, case sensitive table names are assumed. |
[in] | maxLineLength | - optional parameter that indicates the maximum number of written characters in one line in the written text file. If not specified, STD_CIF_LINE_LENGTH is used. |
[in] | nullValue | - optional parameter that indicates the character that is to be used to denote unknown value in the written CIF file. If not specified, CifString::NullValue is used. |
None |
CifFile::~CifFile | ( | ) |
Destructs a CIF file, by releasing all consumed resources.
Not applicable |
None |
bool CifFile::GetVerbose | ( | ) | [inline] |
Retrieves logging option.
None |
false - if logging is turned off
None |
void CifFile::SetSmartPrint | ( | bool | smartPrint = true |
) | [inline] |
Sets smart printing option. Smart printing is used to beautify the output of a written text file.
smartPrint | - smart printing. If false, smart printing is disabled. If true, smart printing is enabled. If not specified, smart printing is enabled. |
None |
bool CifFile::IsSmartPrint | ( | ) | [inline] |
Retrieves smart printing option.
None |
false - if smart printing is disabled
None |
void CifFile::SetQuoting | ( | eQuoting | quoting | ) |
Sets quoting option. This option is used in order to select the type of quoting to be used in the written text file.
quoting | - type of quoting. If eSINGLE, single quotes are used. If eDOUBLE, double quotes are used. |
None |
unsigned int CifFile::GetQuoting | ( | ) |
Retrieves quoting option.
None |
eDOUBLE - if double quotes are used
None |
void CifFile::Write | ( | const string & | cifFileName, | |
const bool | sortTables = false , |
|||
const bool | writeEmptyTables = false | |||
) |
Writes the data out to a text file.
[in] | cifFileName | - relative or absolute name of the text file to which the data from CifFile object is to be written to. |
[in] | sortTables | - optional parameter that indicates whether written tables should be sorted (if true) or not sorted (if false). If sortTables is not spefified, tables are not sorted prior to writing them. |
[in] | writeEmptyTables | - optional parameter that indicates whether empty tables (0 rows) are to be written (if true) or not written (if false). If writeEmptyTables is not spefified, empty tables are not written. |
None |
void CifFile::Write | ( | const string & | cifFileName, | |
const vector< string > & | tableOrder, | |||
const bool | writeEmptyTables = false | |||
) |
Writes the data out to a text file.
[in] | cifFileName | - relative or absolute name of the text file to which the data from CifFile object is to be written to. |
[in] | tableOrder | - vector of table names that indicates the order of written tables. |
[in] | writeEmptyTables | - optional parameter that indicates whether empty tables (0 rows) are to be written (if true) or not written (if false). If writeEmptyTables is not spefified, empty tables are not written. |
None |
int CifFile::DataChecking | ( | CifFile & | dicRef | ) |
Checks a CIF file against the dictionary.
[in] | dicRef | - reference to a dictionary file |
different than 0 - if checks failed
None |
void CifFile::GetItemNames | ( | vector< string > & | itemNames, | |
ISTable & | isTable | |||
) | [static] |
Constructs CIF item names in the form "_<category>.<item>", by using the table name for the category name and each column name for the item name.
[out] | itemNames | - constructed CIF item names. The number of CIF items is equal to the number of table columns. |
[in] | isTable | - table reference |
None |
int CifFile::_IsQuotableText | ( | const string & | itemValue | ) | [protected] |
CifFile::eIdentType CifFile::_FindPrintType | ( | const vector< string > & | values | ) | [protected] |
void CifFile::_PrintItemIdent | ( | ostream & | cifo, | |
unsigned int & | linePos | |||
) | [protected] |
void CifFile::_PrintItemName | ( | ostream & | cifo, | |
const string & | category, | |||
const string & | itemName, | |||
unsigned int & | linePos | |||
) | [protected] |
void CifFile::_PrintPostItemSeparator | ( | ostream & | cifo, | |
unsigned int & | linePos, | |||
const bool | ident = false , |
|||
const unsigned int | numSpaces = 1 | |||
) | [protected] |
int CifFile::_PrintItemValue | ( | ostream & | cifo, | |
const string & | itemValue, | |||
unsigned int & | linePos, | |||
const eIdentType | identType = eNONE , |
|||
const unsigned int | width = 0 | |||
) | [protected] |
int CifFile::_PrintItemNameInHeader | ( | ostream & | cifo, | |
const string & | itemValue, | |||
unsigned int & | linePos, | |||
const eIdentType | identType = eNONE , |
|||
const unsigned int | width = 0 | |||
) | [protected] |
void CifFile::_PrintHeaderedItems | ( | ostream & | cifo, | |
const vector< string > & | colNames, | |||
const vector< unsigned int > & | colWidths, | |||
const vector< eIdentType > | colPrintType | |||
) | [protected] |
void CifFile::Write | ( | ostream & | cifo, | |
const bool | sortTables = false , |
|||
const bool | writeEmptyTables = false | |||
) | [protected] |
void CifFile::Write | ( | ostream & | cifo, | |
const vector< string > & | catOrder, | |||
const bool | writeEmptyTables = false | |||
) | [protected] |
void CifFile::Write | ( | ostream & | cifo, | |
vector< unsigned int > & | tables, | |||
const bool | writeEmptyTables = false | |||
) | [protected] |
int CifFile::MandatoryCategoryChecking | ( | CifFile & | ref, | |
ofstream & | log | |||
) | [protected] |
int CifFile::ItemsChecking | ( | CifFile & | ref, | |
ofstream & | log | |||
) | [protected] |
void CifFile::Init | ( | ) | [private] |
void CifFile::ConvertEscapedString | ( | const string & | inString, | |
string & | outString | |||
) | [private] |
const unsigned int CifFile::STD_CIF_LINE_LENGTH = 80 [static] |
const unsigned int CifFile::STD_PRINT_SPACING = 3 [static, protected] |
const unsigned int CifFile::SMART_PRINT_SPACING = 1 [static, protected] |
const unsigned int CifFile::HEADER_SPACING = 40 [static, protected] |
unsigned int CifFile::_maxCifLineLength [protected] |
string CifFile::_nullValue [protected] |
bool CifFile::_verbose [protected] |
bool CifFile::_smartPrint [protected] |
string CifFile::_quotes [protected] |