本文整理汇总了C++中PProperty::GetValueAsArrayString方法的典型用法代码示例。如果您正苦于以下问题:C++ PProperty::GetValueAsArrayString方法的具体用法?C++ PProperty::GetValueAsArrayString怎么用?C++ PProperty::GetValueAsArrayString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PProperty
的用法示例。
在下文中一共展示了PProperty::GetValueAsArrayString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPropertyAsArrayString
wxArrayString ObjectBase::GetPropertyAsArrayString(const wxString& pname)
{
PProperty property = GetProperty( pname );
if (property)
return property->GetValueAsArrayString();
else
return wxArrayString();
}
示例2: ParseForEach
bool TemplateParser::ParseForEach()
{
// Whitespaces at the very start are ignored
ignore_whitespaces();
// parsing the property
if (GetNextToken() == TOK_PROPERTY)
{
wxString propname = ParsePropertyName();
wxString inner_template = ExtractInnerTemplate();
PProperty property = m_obj->GetProperty(propname);
wxString propvalue = property->GetValue();
// Property value must be an string using ',' as separator.
// The template will be generated nesting as many times as
// tokens were found in the property value.
if (property->GetType() == PT_INTLIST || property->GetType() == PT_UINTLIST)
{
// For doing that we will use wxStringTokenizer class from wxWidgets
wxStringTokenizer tkz( propvalue, wxT(","));
int i = 0;
while (tkz.HasMoreTokens())
{
wxString token;
token = tkz.GetNextToken();
token.Trim(true);
token.Trim(false);
// Parsing the internal template
{
wxString code;
PTemplateParser parser = CreateParser( this, inner_template );
parser->SetPredefined( token, wxString::Format( wxT("%i"), i++ ) );
code = parser->ParseTemplate();
m_out << wxT("\n") << code;
}
}
}
else if (property->GetType() == PT_STRINGLIST)
{
wxArrayString array = property->GetValueAsArrayString();
for ( unsigned int i = 0 ; i < array.Count(); i++ )
{
wxString code;
PTemplateParser parser = CreateParser(this,inner_template);
parser->SetPredefined( ValueToCode( PT_WXSTRING_I18N, array[i] ), wxString::Format( wxT("%i"), i ) );
code = parser->ParseTemplate();
m_out << wxT("\n") << code;
}
}
else
wxLogError(wxT("Property type not compatible with \"foreach\" macro"));
}
return true;
}