24 m_keyName( a_keyName ),
26 m_allowsLazyParsing( false ) {
35Suite::Suite( std::string
const &a_moniker, std::string
const &a_keyName ) :
37 m_keyName( a_keyName ),
39 m_allowsLazyParsing( false ) {
61 m_keyName( a_keyName ),
63 m_allowsLazyParsing( a_allowsLazyParsing ),
69 if( !node.
empty( ) )
parse( a_construction, node, a_setupInfo, a_pops, a_internalPoPs, a_parseSuite, a_styles );
77 for( std::vector<Form *>::const_iterator iter = m_forms.begin( ); iter < m_forms.end( ); ++iter )
delete *iter;
97 std::string name( child.name( ) );
101 if( m_allowsLazyParsing && a_construction.
lazyParsing( ) ) {
102 form =
new LazyParsingHelperForm( a_construction,
this, child, a_setupInfo, a_pops, a_internalPoPs, name, a_styles, a_parseSuite ); }
104 form = a_parseSuite( a_construction,
this, child, a_setupInfo, a_pops, a_internalPoPs, name, a_styles );
106 if( form !=
nullptr )
add( form );
118 auto iter = m_map.find( a_keyValue );
119 if( iter == m_map.end( ) ) {
120 throw Exception(
"form '" + a_keyValue +
"' not in suite " +
toXLink( ) +
"." );
123 return( iter->second );
136 for(
Suite::iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter, ++i1 ) {
137 if( (*iter)->keyValue( ) == a_form->
keyValue( ) ) {
138 m_forms[i1] = a_form;
143 m_map[a_form->
keyValue( )] = m_forms.size( );
144 m_forms.push_back( a_form );
158 Form *form = m_forms[a_index];
163 if( form ==
nullptr ) {
167 m_forms[a_index] = form;
185 Form *form = m_forms[a_index];
190 if( form !=
nullptr ) {
192 m_forms[a_index] = form;
209 if( a_iter ==
end( ) )
return( a_iter );
211 std::size_t index = (*this)[(*a_iter)->keyValue()];
228 if( a_iter ==
end( ) )
return( a_iter );
230 std::size_t index = (*this)[(*a_iter)->keyValue()];
248 for(
Suite::iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) {
249 if( (*iter)->keyValue( ) == a_keyValue ) {
254 return( m_forms.end( ) );
269 if( (*iter)->keyValue( ) == a_keyValue ) {
274 return( m_forms.end( ) );
287 std::vector<Suite::iterator> iters;
289 for(
Suite::iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) {
290 if( (*iter)->moniker( ) == a_moniker ) iters.push_back( iter );
306 std::vector<Suite::const_iterator> iters;
309 if( (*iter)->moniker( ) == a_moniker ) iters.push_back( iter );
326 Form const *form1 =
nullptr;
327 auto formIter = m_forms.end( );
329 for(
auto iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) {
330 if( (*iter)->label( ) == a_label )
break;
331 if( (*iter)->actualMoniker( ) == a_moniker ) formIter = iter;
334 if( formIter != m_forms.end( ) ) {
353 auto stylesIter = a_styles.
find( a_label );
354 if( stylesIter != a_styles.
end( ) ) {
355 auto suiteIter =
find( a_label );
356 if( suiteIter !=
end( ) ) {
376 for(
auto iter = a_maximumTNSL_MultiGroupIndex.begin( ); iter != a_maximumTNSL_MultiGroupIndex.end( ); ++iter ) {
377 auto formIter =
find( iter->first,
true );
379 if( formIter == m_forms.end( ) )
continue;
398 std::size_t index( a_item.find(
'=' ) ), lastQuote = a_item.size( ) - 2;
400 if( index == std::string::npos )
return(
nullptr );
402 if( index > lastQuote )
throw Exception(
"Suite::findInAncestry3: invalide xlink" );
403 if( a_item[index] !=
'\'' )
throw Exception(
"Suite::findInAncestry3: invalid xlink, missing '." );
405 if( a_item[lastQuote] !=
'\'' )
throw Exception(
"Suite::findInAncestry3: invalid xlink, missing endl '." );
407 std::string keyValue( a_item.substr( index, lastQuote - index ) );
421 std::size_t index( a_item.find(
'=' ) ), lastQuote = a_item.size( ) - 2;
423 if( index == std::string::npos )
return(
nullptr );
425 if( index > lastQuote )
throw Exception(
"Suite::findInAncestry3: invalide xlink" );
426 if( a_item[index] !=
'\'' )
throw Exception(
"Suite::findInAncestry3: invalid xlink, missing '." );
428 if( a_item[lastQuote] !=
'\'' )
throw Exception(
"Suite::findInAncestry3: invalid xlink, missing endl '." );
430 std::string keyValue( a_item.substr( index, lastQuote - index ) );
446 if(
size( ) == 0 )
return;
448 std::string XMLLine( a_indent +
"<" +
moniker( ) +
">" );
451 for(
Suite::const_iterator iter = m_forms.begin( ); iter != m_forms.end( ); ++iter ) (*iter)->toXMLList( a_writeInfo, indent2 );
464 std::cout << a_header <<
": size = " <<
size( ) << std::endl;
467 std::cout <<
" " << (*iter)->keyValue( ) << std::endl;
490 Suite( a_construction, a_moniker, a_keyName, a_node, a_setupInfo, a_pops, a_internalPoPs, a_parseSuite, a_styles, true ) {
500 Suite( a_moniker, a_keyName ) {
527 m_construction( a_construction ),
529 m_setupInfo( a_setupInfo ),
531 m_internalPoPs( &a_internalPoPs ),
533 m_styles( a_styles ),
534 m_parser( a_parser ) {
536 m_construction.setLazyParsing(
false );
537 m_setupInfo.m_protare->incrementNumberOfLazyParsingHelperForms( );
546 Form *form = m_parser( m_construction,
parent( ), m_node, m_setupInfo, *m_pops, *m_internalPoPs, m_name, m_styles );
547 m_setupInfo.m_protare->incrementNumberOfLazyParsingHelperFormsReplaced( );
Component(Construction::Settings const &a_construction, std::string const &a_moniker, std::string const &a_keyName, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, parseSuite a_parseSuite, Styles::Suite const *a_styles)
void parse(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pops, PoPI::Database const &a_internalPoPs, parseSuite a_parseSuite, Styles::Suite const *a_styles)
std::vector< iterator > findAllOfMoniker(std::string const &a_moniker)
Form * checkLazyParsingHelperForm(std::size_t a_index)
iterator checkLazyParsingHelperFormIterator(iterator a_iter)
GUPI::Ancestry * findInAncestry3(std::string const &a_item)
Form const * findInstanceOfTypeInLineage(std::string const &_label, std::string const &a_moniker) const
void printFormLabels(std::string const &a_header) const
void toXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent="") const
Suite(std::string const &a_keyName=GIDI_labelChars)
std::size_t operator[](std::string const &a_label) const
T * get(std::size_t a_Index)
iterator find(std::string const &a_label, bool a_convertLazyParsingHelperForm=false)
Forms::const_iterator const_iterator
void modifiedMultiGroupElasticForTNSL(std::map< std::string, std::size_t > const &a_maximumTNSL_MultiGroupIndex)
void setAncestor(Ancestry *a_ancestor)
std::string const & moniker() const
Ancestry(std::string const &a_moniker, std::string const &a_attribute="")
std::string toXLink() const
void push_back(std::string const &a_line)
void addNodeEnder(std::string const &a_moniker)
std::string incrementalIndent(std::string const &indent)
std::string attribute_as_string(const char *a_name) const
Node child(const char *name) const
Form *(* parseSuite)(Construction::Settings const &a_construction, Suite *a_parent, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pop, PoPI::Database const &a_internalPoPs, std::string const &a_name, Styles::Suite const *a_styles)