本文整理汇总了C++中StringList::array方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::array方法的具体用法?C++ StringList::array怎么用?C++ StringList::array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::array方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
//------------------------------------------------------------
static void
writeTOC(BookCaseDB &db,
info_lib *mmdb,
const char *bcname,
const char *thisBook,
DBCursor &toc_cursor )
{
DBTable *out = db.DB::table(DATABASE_STDIO,
TOC_CODE, NUM_TOC_FIELDS,
DB::CREATE);
const char *aBook;
const char *nodeLoc;
const char *parent;
int childQty;
char **children;
int treeSize;
while(toc_cursor.next(STRING_CODE, &aBook,
STRING_CODE, &nodeLoc,
STRING_CODE, &parent,
SHORT_LIST_CODE, &childQty, STRING_CODE, &children,
INTEGER_CODE, &treeSize,
NULL)){
StringList heap;
if(strcmp(aBook, thisBook) != 0){ /* book id has changed! We're done... */
toc_cursor.undoNext();
break;
}
for(int i = 0; i < childQty; i++){
heap.append(to_oid(mmdb, bcname, children[i]));
}
const char *nodeOID = heap.append(to_oid(mmdb, bcname, nodeLoc));
const char *parentOID = heap.append(to_oid(mmdb, bcname, parent));
#ifdef FISH_DEBUG
DBUG_PRINT("TOC", ("TOC Entry: O:%s treesize: %d\n", nodeOID, treeSize));
#endif
out->insert(OID_CODE, nodeOID,
OID_CODE, parentOID,
INTEGER_CODE, treeSize,
/* first childQty strings in heap are oids for children */
OID_LIST_CODE, childQty, heap.array(),
NULL);
}
delete out;
}
示例2: cursor
//.........这里部分代码省略.........
/*
* First put the global node table into hash dictionary
*/
hashTable<CC_String,BTCollectable> global_node_tab(hash_func);
create_node_dict( global_node_tab , db); /* throw exception if duplicate
node locator is found */
int exception_flag = 0;
while(cursor.next(STRING_CODE, &bookLocator,
STRING_CODE, &stitle,
STRING_CODE, &title,
INTEGER_CODE, &seq_no,
SHORT_LIST_CODE, &tabQty, STRING_CODE, &tabLines,
STRING_CODE, &access,
NULL)){
StringList heap;
/* convert tab to oids in forst tabQty items in heap */
for(int i = 0; i < tabQty; i++){
char *t = (char *)tabLines[i];
const char *name = strtok( t, "\t" );
const char *loc = strtok( NULL, "\t");
const char *line = strtok( NULL, "\t");
const char *file_name = strtok( NULL, "\t");
int nameLen = strlen( name );
/*
* First check if the tab link is resolved
*/
CC_String key ( loc );
BTCollectable *tab_link = (BTCollectable *)global_node_tab.
findValue( &key );
if ( !tab_link ) {
cerr << "(ERROR) Tab ID = " << loc << endl
<< " of book = " << title << endl
<< " specified in file = " << file_name << endl
<< " at line = " << line << endl
<< " is not pointing to any section ID found in the book\n\n";
exception_flag = 1;
}
else {
/*
* see if it is a node locator within the same book
*/
if ( strcmp( tab_link->get_value(), bookLocator )) {
cerr << "(ERROR) Tab ID = " << loc << endl
<< " of book = " << title << endl
<< " specified in file = " << file_name << endl
<< " at line = " << line << endl
<< " is not pointing to any section ID found in the book\n\n";
exception_flag = 1;
}
}
// if exception_flag is set, calling to_oid will throw exception
// It will just loop through all the tabs, and report all the bad ones
if ( !exception_flag ) {
const char *tabOID = to_oid(mmdb, bcname, loc);
char *result = new char[nameLen + 1 + strlen(tabOID) + 1];
sprintf(result, "%s\t%s", name, tabOID );
heap.add(result);
}
}
if ( !exception_flag ) {
const char *bookOID = heap.append(to_oid(mmdb, bcname, bookLocator));
#ifdef FISH_DEBUG
DBUG_PRINT("CCF", ("Load Book: O:%s `%s'\n", bookOID, title));
#endif
ccf->insert(OID_CODE, bookOID,
STRING_CODE, stitle,
STRING_CODE, title,
INTEGER_CODE, seq_no,
SHORT_LIST_CODE, tabQty, STRING_CODE, heap.array(),
STRING_CODE, access,
NULL);
}
}
if ( exception_flag ) {
throw(Unexpected("Tab validation failed"));
}
delete ccf;
global_node_tab.clearAndDestroy();
}