本文整理汇总了C++中SerializableList类的典型用法代码示例。如果您正苦于以下问题:C++ SerializableList类的具体用法?C++ SerializableList怎么用?C++ SerializableList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SerializableList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxASSERT
void wxXmlSerializer::SetRootItem(xsSerializable* root)
{
wxASSERT(root);
wxASSERT(root->IsKindOf(CLASSINFO(xsSerializable)));
if( m_pRoot )delete m_pRoot;
if(root && root->IsKindOf(CLASSINFO(xsSerializable)))
{
m_pRoot = root;
}
else
m_pRoot = new xsSerializable();
// update pointers to parent manager
m_mapUsedIDs.clear();
m_pRoot->m_pParentManager = this;
m_mapUsedIDs[m_pRoot->GetId()] = m_pRoot;
xsSerializable *pItem;
SerializableList lstItems;
GetItems(NULL, lstItems);
SerializableList::compatibility_iterator node = lstItems.GetFirst();
while( node )
{
pItem = node->GetData();
pItem->m_pParentManager = this;
m_mapUsedIDs[pItem->GetId()] = pItem;
node = node->GetNext();
}
}
示例2: GetRootItem
void wxSFDiagramManager::GetAssignedConnections(wxSFShapeBase* parent, wxClassInfo* shapeInfo, wxSFShapeBase::CONNECTMODE mode, ShapeList& lines)
{
wxSFLineShape* pLine;
if( parent->GetId() == -1 ) return;
SerializableList lstLines;
// lines are children of root item only so we have not to search recursively...
GetRootItem()->GetChildren( shapeInfo, lstLines );
if( !lstLines.IsEmpty() )
{
SerializableList::compatibility_iterator node = lstLines.GetFirst();
while(node)
{
pLine = (wxSFLineShape*)node->GetData();
switch(mode)
{
case wxSFShapeBase::lineSTARTING:
if( pLine->GetSrcShapeId() == parent->GetId() ) lines.Append(pLine);
break;
case wxSFShapeBase::lineENDING:
if( pLine->GetTrgShapeId() == parent->GetId() ) lines.Append(pLine);
break;
case wxSFShapeBase::lineBOTH:
if( ( pLine->GetSrcShapeId() == parent->GetId() ) ||
( pLine->GetTrgShapeId() == parent->GetId() ) ) lines.Append(pLine);
break;
}
node = node->GetNext();
}
}
}
示例3: Contains
bool wxXmlSerializer::Contains(wxClassInfo *type)
{
SerializableList lstItems;
GetItems( type, lstItems );
return !lstItems.IsEmpty();
}
示例4: testClear
void testClear( )
{
FileBasedStore store( DIRECTORY_BASE );
std::string sectionName = "alpha";
SerializableList allValues;
allValues.push_back( makeSerializableWrapperPtr( 10 ) );
store.saveSection( sectionName, allValues );
store.clear();
CPPUNIT_ASSERT( ! store.hasSection( sectionName ) );
}
示例5: GetItems
udSettingsCategory* udSettings::GetCategory(const wxString& name)
{
SerializableList lstCategories;
GetItems( CLASSINFO(udSettingsCategory), lstCategories );
SerializableList::compatibility_iterator node = lstCategories.GetFirst();
while( node )
{
if( ((udSettingsCategory*)node->GetData())->GetName() == name ) return (udSettingsCategory*)node->GetData();
node = node->GetNext();
}
return NULL;
}
示例6: GetItems
int wxXmlSerializer::GetIDCount(long id)
{
int nCount = 0;
SerializableList items;
GetItems(CLASSINFO(xsSerializable), items);
SerializableList::compatibility_iterator node = items.GetFirst();
while(node)
{
if( node->GetData()->GetId() == id ) nCount++;
node = node->GetNext();
}
if( m_pRoot->GetId() == id ) nCount++;
return nCount;
}
示例7: GetColumn
void TableSettings::OnRemoveColumnClick(wxCommandEvent& event)
{
Column *col = GetColumn( GetSelectedColumnName() );
if( col ) {
// delete associated keys
SerializableList keys;
GetConstraints( keys, col->GetName() );
for(SerializableList::iterator it = keys.begin(); it != keys.end(); ++it ) {
Constraint *key = (Constraint*) *it;
m_lstKeys.DeleteObject( key );
delete key;
}
// delete the column
m_lstColumns.DeleteObject( col );
delete col;
UpdateView();
}
}
示例8: GetConstraints
void TableSettings::GetConstraints(SerializableList& keys, const wxString& localcol)
{
for( SerializableList::iterator it = m_lstKeys.begin();
it != m_lstKeys.end(); ++it ) {
Constraint *c = wxDynamicCast( *it, Constraint );
if( c && ( c->GetLocalColumn() == localcol ) ) keys.Append( *it );
}
}
示例9: testSaveSection
void testSaveSection( )
{
FileBasedStore store( DIRECTORY_BASE );
RecordedGrip grip = makeSerializableWrapperPtr( 10 );
SerializableList allValues;
allValues.push_back( grip );
store.saveSection( "anExample", allValues );
CPPUNIT_ASSERT( store.hasSection( "anExample" ) );
SerializableList retrievedValues;
store.retrieveSection( "anExample", retrievedValues );
CPPUNIT_ASSERT( grip == *( retrievedValues.begin( ) ) );
}
示例10: GetChild
xsSerializable* xsSerializable::GetChild(long id, bool recursive)
{
SerializableList lstChildren;
SerializableList::compatibility_iterator node;
if( recursive )
{
GetChildrenRecursively( CLASSINFO(xsSerializable), lstChildren );
node = lstChildren.GetFirst();
}
else
node = m_lstChildItems.GetFirst();
while(node)
{
if( node->GetData()->GetId() == id) return node->GetData();
node = node->GetNext();
}
return NULL;
}
示例11: CLASSINFO
void udCPPClassElementProcessor::ProcessClassMembers(wxSFShapeBase* element)
{
SerializableList lstMembers;
umlClassDiagram::GetClassMembers( (umlClassItem*)element, CLASSINFO(udMemberDataLinkItem), (udLanguage::ACCESSTYPE)-1, lstMembers );
if( !lstMembers.IsEmpty() )
{
udMemberDataItem *pVar;
udLanguage *pLang = m_pParentGenerator->GetActiveLanguage();
pLang->SingleLineCommentCmd( wxT("member data initialization") );
for( SerializableList::iterator it = lstMembers.begin(); it != lstMembers.end(); ++it )
{
pVar = (udMemberDataItem*)((udMemberDataLinkItem*)*it)->GetOriginal();
if( !pVar->GetValue().IsEmpty() ) pLang->WriteCodeBlocks( pVar->ToString( udCodeItem::cfDEFINITION, pLang ) );
}
pLang->NewLine();
}
}
示例12: InitChild
void xsSerializable::InitChild(xsSerializable* child)
{
if( child )
{
child->m_pParentItem = this;
if( m_pParentManager )
{
if( child->m_pParentManager != m_pParentManager )
{
child->m_pParentManager = m_pParentManager;
// assign unique ids to the child object
if( child->GetId() == -1 ) child->SetId(m_pParentManager->GetNewId());
else
m_pParentManager->GetUsedIDs()[child->GetId()] = child;
// if the child has another children, set their parent manager and ID as well
xsSerializable *pItem;
SerializableList lstChildren;
child->GetChildrenRecursively( NULL, lstChildren );
SerializableList::compatibility_iterator node = lstChildren.GetFirst();
while( node )
{
pItem = node->GetData();
pItem->SetParentManager( m_pParentManager );
if( pItem->GetId() == -1 ) pItem->SetId(m_pParentManager->GetNewId());
else
m_pParentManager->GetUsedIDs()[pItem->GetId()] = pItem;
node = node->GetNext();
}
}
}
}
}
示例13: GetChildren
void xsSerializable::GetChildren(wxClassInfo *type, SerializableList& list)
{
xsSerializable *pChild;
SerializableList::compatibility_iterator node = m_lstChildItems.GetFirst();
while(node)
{
pChild = node->GetData();
if( !type || pChild->IsKindOf(type) ) list.Append(pChild);
node = node->GetNext();
}
}
示例14: GetChildrenRecursively
void xsSerializable::GetChildrenRecursively(wxClassInfo *type, SerializableList& list, SEARCHMODE mode)
{
xsSerializable *pChild;
SerializableList::compatibility_iterator node = m_lstChildItems.GetFirst();
while(node)
{
pChild = node->GetData();
if( !type || pChild->IsKindOf(type) ) list.Append(pChild);
if( mode == searchDFS ) pChild->GetChildrenRecursively(type, list);
node = node->GetNext();
}
if( mode == searchBFS )
{
node = m_lstChildItems.GetFirst();
while(node)
{
node->GetData()->GetChildrenRecursively(type, list);
node = node->GetNext();
}
}
}
示例15: wxDynamicCast
void udCPPClassElementProcessor::ProcessClassDeclaration(wxSFShapeBase* element)
{
udLanguage *pLang = m_pParentGenerator->GetActiveLanguage();
udClassAlgorithm *pAlg = (udClassAlgorithm*) m_pParentGenerator->GetActiveAlgorithm();
// get base classes if exists
ShapeList lstBases;
umlClassDiagram::GetBaseClasses( (umlClassItem*)element, lstBases );
int nTemplateIndex = 0;
wxString sBases;
for( ShapeList::iterator it = lstBases.begin(); it != lstBases.end(); ++it )
{
if( it != lstBases.begin() ) sBases << wxT(", ");
sBases << pLang->MakeValidIdentifier( udPROJECT::GetDiagramElement(*it)->GetName() );
// add template parameter if exists
umlClassTemplateItem *pTemplate = wxDynamicCast( *it, umlClassTemplateItem );
if( pTemplate )
{
// find corespondent template binding connection
ShapeList lstConnections;
element->GetShapeManager()->GetAssignedConnections( element, CLASSINFO(umlTemplateBindItem), wxSFShapeBase::lineSTARTING, lstConnections );
if( !lstConnections.IsEmpty() )
{
// append bind type to the base name
udTemplateBindElementItem *pBindElement = wxDynamicCast( udPROJECT::GetDiagramElement( lstConnections.Item(nTemplateIndex)->GetData() ), udTemplateBindElementItem );
if( pBindElement )
{
sBases << wxT("<") << pBindElement->GetBindType() << wxT(">");
}
}
nTemplateIndex++;
}
}
udClassElementItem *pClass = (udClassElementItem*) udPROJECT::GetDiagramElement(element);
//generate comment if requested
pLang->WriteCodeBlocks( udGenerator::GetComment( pClass, pLang) );
// write template definition if needed
udClassTemplateElementItem *pClassTempl = wxDynamicCast( pClass, udClassTemplateElementItem );
if( pClassTempl )
{
pLang->WriteCodeBlocks( wxT("template <typename ") + pClassTempl->GetTemplateName() + wxT(">") );
}
// generate class declaration
pLang->ClassDeclCmd( pLang->MakeValidIdentifier( pClass->GetName() ), sBases );
pLang->BeginCmd();
// declare class members
int nAccessType = 0;
wxClassInfo *pPrevType;
SerializableList lstMembers;
ShapeList lstAssocs;
while( pLang->GetAccessTypeString( (udLanguage::ACCESSTYPE) nAccessType ) != wxEmptyString )
{
pLang->WriteCodeBlocks( pLang->GetAccessTypeString( (udLanguage::ACCESSTYPE) nAccessType ) + wxT(":") );
pLang->IncIndentation();
lstMembers.Clear();
lstAssocs.Clear();
pPrevType = NULL;
// process associations
umlClassDiagram::GetClassAssociations( (umlClassItem*) element, CLASSINFO(wxSFLineShape), wxSFLineShape::lineSTARTING, (udLanguage::ACCESSTYPE) nAccessType, lstAssocs );
for( ShapeList::iterator it = lstAssocs.begin(); it != lstAssocs.end(); ++it )
{
udElementProcessor *pProcessor = pAlg->GetElementProcessor( (*it)->GetClassInfo()->GetClassName() );
if( pProcessor ) pProcessor->ProcessElement( *it );
}
// process class members
umlClassDiagram::GetClassMembers( (umlClassItem*) element, CLASSINFO(udMemberDataLinkItem), (udLanguage::ACCESSTYPE) nAccessType, lstMembers);
umlClassDiagram::GetClassMembers( (umlClassItem*) element, CLASSINFO(udMemberFunctionLinkItem), (udLanguage::ACCESSTYPE) nAccessType, lstMembers);
for( SerializableList::iterator it = lstMembers.begin(); it != lstMembers.end(); ++it )
{
if( pPrevType && ((*it)->GetClassInfo() != pPrevType) ) pLang->NewLine();
// generate comment
pLang->WriteCodeBlocks( udGenerator::GetComment( ((udCodeLinkItem*)*it)->GetOriginal(), pLang ) );
// generate function decl
pLang->WriteCodeBlocks( ((udCodeLinkItem*)*it)->ToString( udCodeItem::cfDECLARATION, pLang ) );
pPrevType = (*it)->GetClassInfo();
}
nAccessType++;
pLang->DecIndentation();
pLang->NewLine();
}
//.........这里部分代码省略.........