当前位置: 首页>>代码示例>>C++>>正文


C++ PProperty::GetValueAsArrayString方法代码示例

本文整理汇总了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();
}
开发者ID:heyuqi,项目名称:wxFormBuilder,代码行数:8,代码来源:objectbase.cpp

示例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;
}
开发者ID:joro75,项目名称:wxFormBuilder,代码行数:58,代码来源:codegen.cpp


注:本文中的PProperty::GetValueAsArrayString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。