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


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

本文整理汇总了C++中PProperty::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ PProperty::GetValue方法的具体用法?C++ PProperty::GetValue怎么用?C++ PProperty::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PProperty的用法示例。


在下文中一共展示了PProperty::GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: str

status_t
PControl::SetProperty(const char *name, PValue *value, const int32 &index)
{
	// Modal, Front, and Floating properties are missing because they are read-only
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	status_t status = prop->SetValue(value);
	if (status != B_OK)
		return status;
	
	if (!fView)
		return B_NO_INIT;
	
	BControl *viewAsControl = (BControl*)fView;
	
	BoolValue bv;
	IntValue iv;
	StringValue sv;
	
	if (viewAsControl->Window())
		viewAsControl->Window()->Lock();
	
	if (str.ICompare("Enabled") == 0)
	{
		prop->GetValue(&bv);
		viewAsControl->SetEnabled(bv.value);
	}
	else if (str.ICompare("Label") == 0)
	{
		prop->GetValue(&sv);
		viewAsControl->SetLabel(sv.value->String());
		viewAsControl->Invalidate();
	}
	else if (str.ICompare("Value") == 0)
	{
		prop->GetValue(&iv);
		viewAsControl->SetValue(*iv.value);
	}
	else
	{
		if (viewAsControl->Window())
			viewAsControl->Window()->Unlock();
		return PView::SetProperty(name,value,index);
	}

	if (viewAsControl->Window())
		viewAsControl->Window()->Unlock();
	
	return prop->GetValue(value);
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:56,代码来源:PControl.cpp

示例2: str

status_t
PLabel::SetProperty(const char *name, PValue *value, const int32 &index)
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
		return B_READ_ONLY;
	
	BStringView *backend = (BStringView*)fView;
	
	BoolValue boolval;
	CharValue charval;
	ColorValue colorval;
	FloatValue floatval;
	IntValue intval;
	PointValue pointval;
	RectValue rectval;
	StringValue stringval;
	
	status_t status = prop->SetValue(value);
	if (status != B_OK)
		return status;

	if (backend->Window())
		backend->Window()->Lock();

	if (str.ICompare("Alignment") == 0)
	{
		prop->GetValue(&intval);
		backend->SetAlignment((alignment)*intval.value);
	}
	else if (str.ICompare("Text") == 0)
	{
		prop->GetValue(&stringval);
		backend->SetText(*stringval.value);
	}
	else
	{
		if (backend->Window())
			backend->Window()->Unlock();

		return PView::SetProperty(name, value, index);
	}

	if (backend->Window())
		backend->Window()->Unlock();

	return prop->GetValue(value);
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:55,代码来源:PLabel.cpp

示例3: FindMacros

void PHPCodeGenerator::FindMacros( PObjectBase obj, std::vector<wxString>* macros )
{
	// iterate through all of the properties of all objects, add the macros
	// to the vector
	unsigned int i;

	for ( i = 0; i < obj->GetPropertyCount(); i++ )
	{
		PProperty prop = obj->GetProperty( i );
		if ( prop->GetType() == PT_MACRO )
		{
			wxString value = prop->GetValue();
			if( value.IsEmpty() ) continue;

			// Skip wx IDs
			if ( ( ! value.Contains( wxT("XRCID" ) ) ) &&
				 ( m_predMacros.end() == m_predMacros.find( value ) ) )
			{
				if ( macros->end() == std::find( macros->begin(), macros->end(), value ) )
				{
					macros->push_back( value );
				}
			}
		}
	}

	for ( i = 0; i < obj->GetChildCount(); i++ )
	{
		FindMacros( obj->GetChild( i ), macros );
	}
}
开发者ID:heyuqi,项目名称:wxFormBuilder,代码行数:31,代码来源:phpcg.cpp

示例4: SerializeObject

void ObjectBase::SerializeObject( ticpp::Element* serializedElement )
{
	ticpp::Element element( "object" );
	element.SetAttribute( "class", _STDSTR( GetClassName() ) );
	element.SetAttribute( "expanded", GetExpanded() );

	for ( unsigned int i = 0; i < GetPropertyCount(); i++ )
	{
		PProperty prop = GetProperty( i );
		ticpp::Element prop_element( "property" );
		prop_element.SetAttribute( "name", _STDSTR( prop->GetName() ) );
		prop_element.SetText( _STDSTR( prop->GetValue() ) );
		element.LinkEndChild( &prop_element );
	}

	for ( unsigned int i = 0; i < GetEventCount(); i++ )
	{
		PEvent event = GetEvent( i );
		ticpp::Element event_element( "event" );
		event_element.SetAttribute( "name", _STDSTR( event->GetName() ) );
		event_element.SetText( _STDSTR( event->GetValue() ) );
		element.LinkEndChild( &event_element );
	}

	for ( unsigned int i = 0 ; i < GetChildCount(); i++ )
	{
		PObjectBase child = GetChild( i );
		ticpp::Element child_element;
		child->SerializeObject( &child_element );
		element.LinkEndChild( &child_element );
	}

	*serializedElement = element;
}
开发者ID:heyuqi,项目名称:wxFormBuilder,代码行数:34,代码来源:objectbase.cpp

示例5: str

status_t
PMenuItem::GetProperty(const char *name, PValue *value, const int32 &index) const
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	BMenuItem *backend = (BMenuItem*)fBackend;
	if (str.ICompare("Message") == 0)
		((IntProperty*)prop)->SetValue(backend->Command());
	else if (str.ICompare("Trigger") == 0)
		((CharProperty*)prop)->SetValue(backend->Trigger());
	else if (str.ICompare("Label") == 0)
		((StringProperty*)prop)->SetValue(backend->Label());
	else if (str.ICompare("Frame") == 0)
		((RectProperty*)prop)->SetValue(backend->Frame());
	else if (str.ICompare("Marked") == 0)
		((BoolProperty*)prop)->SetValue(backend->IsMarked());
	else if (str.ICompare("Enabled") == 0)
		((BoolProperty*)prop)->SetValue(backend->IsEnabled());
	else
	{
		return PObject::GetProperty(name, value, index);
	}

	return prop->GetValue(value);
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:31,代码来源:PMenuItem.cpp

示例6: 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

示例7: PropertyToCode

wxString TemplateParser::PropertyToCode(PProperty property)
{
	if ( property )
	{
		return ValueToCode(property->GetType(), property->GetValue());
	}
	else
	{
		return wxEmptyString;
	}
}
开发者ID:joro75,项目名称:wxFormBuilder,代码行数:11,代码来源:codegen.cpp

示例8: GetPropertyAsArrayInt

wxArrayInt ObjectBase::GetPropertyAsArrayInt(const wxString& pname)
{
	wxArrayInt array;
	PProperty property = GetProperty( pname );
	if (property)
	{
		IntList il( property->GetValue(), property->GetType() == PT_UINTLIST );
		for (unsigned int i=0; i < il.GetSize() ; i++)
			array.Add(il.GetValue(i));
	}

	return array;
}
开发者ID:heyuqi,项目名称:wxFormBuilder,代码行数:13,代码来源:objectbase.cpp

示例9: str

status_t
PProgressBar::GetProperty(const char *name, PValue *value, const int32 &index) const
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	BStatusBar *backend = (BStatusBar*)fView;

	if (backend->Window())
		backend->Window()->Lock();

	if (str.ICompare("BarColor") == 0)
		((ColorProperty*)prop)->SetValue(backend->BarColor());
	else if (str.ICompare("BarHeight") == 0)
		((FloatProperty*)prop)->SetValue(backend->BarHeight());
	else if (str.ICompare("Label") == 0)
		((StringProperty*)prop)->SetValue(backend->Label());
	else if (str.ICompare("CurrentValue") == 0)
	{
		((FloatProperty*)prop)->SetValue(backend->CurrentValue());
	}
	else if (str.ICompare("MaxValue") == 0)
		((FloatProperty*)prop)->SetValue(backend->MaxValue());
	else if (str.ICompare("Text") == 0)
		((StringProperty*)prop)->SetValue(backend->Text());
	else if (str.ICompare("TrailingLabel") == 0)
		((StringProperty*)prop)->SetValue(backend->TrailingLabel());
	else if (str.ICompare("TrailingText") == 0)
		((StringProperty*)prop)->SetValue(backend->TrailingText());
	else
	{
		if (backend->Window())
			backend->Window()->Unlock();

		return PView::GetProperty(name, value, index);
	}

	if (backend->Window())
		backend->Window()->Unlock();

	return prop->GetValue(value);
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:47,代码来源:PProgressBar.cpp

示例10: FindMacros

void CppCodeGenerator::FindMacros(PObjectBase obj, set<string> &macro_set)
{
  // recorre cada propiedad de cada objeto identificando aquellas
  // que sean macros, en cuyo caso la añade al conjunto.
  unsigned int i;  
 
  for (i=0; i<obj->GetPropertyCount(); i++)
  {
    PProperty prop = obj->GetProperty(i);
    if (prop->GetType() == PT_MACRO)
      macro_set.insert(prop->GetValue());
  }
  
  for (i=0; i<obj->GetChildCount(); i++)
  {
    FindMacros(obj->GetChild(i),macro_set);
  }
}
开发者ID:idrassi,项目名称:wxFormBuilder,代码行数:18,代码来源:cppcg.cpp

示例11: GenClassDeclaration

void PHPCodeGenerator::GenClassDeclaration(PObjectBase class_obj, bool use_enum, const wxString& classDecoration, const EventVector &events, const wxString& eventHandlerPostfix)
{
	PProperty propName = class_obj->GetProperty( wxT("name") );
	if ( !propName )
	{
		wxLogError(wxT("Missing \"name\" property on \"%s\" class. Review your XML object description"),
			class_obj->GetClassName().c_str());
		return;
	}

	wxString class_name = propName->GetValue();
	if ( class_name.empty() )
	{
		wxLogError( wxT("Object name can not be null") );
		return;
	}

	m_source->WriteLn( wxT("/*") );
	m_source->WriteLn( wxT(" * Class ") + class_name);
	m_source->WriteLn( wxT(" */") );
	m_source->WriteLn( );

	m_source->WriteLn( wxT("class ") + classDecoration + class_name + wxT(" extends ") + GetCode( class_obj, wxT("base") ).Trim() + wxT(" {") );
	m_source->Indent();

	// The constructor is also included within public
	GenConstructor( class_obj, events );
	GenDestructor( class_obj, events );

	m_source->WriteLn( wxT("") );

	// event handlers
	GenVirtualEventHandlers(events, eventHandlerPostfix);
	GetGenEventHandlers( class_obj );

	m_source->Unindent();
	m_source->WriteLn( wxT("}") );
	m_source->WriteLn( wxT("") );
}
开发者ID:heyuqi,项目名称:wxFormBuilder,代码行数:39,代码来源:phpcg.cpp

示例12: str

status_t
PDirectory::GetProperty(const char *name, PValue *value, const int32 &index) const
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	BDirectory *backend = (BDirectory*)fBackend;
	if (str.ICompare("IsRoot") == 0)
		((BoolProperty*)prop)->SetValue(backend->IsRootDirectory());
	else if (str.ICompare("EntryCount") == 0)
		((IntProperty*)prop)->SetValue(backend->CountEntries());
	else
	{
		return PNode::GetProperty(name, value, index);
	}

	return prop->GetValue(value);
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:23,代码来源:PDirectory.cpp

示例13: str

status_t
PTextView::GetProperty(const char *name, PValue *value, const int32 &index) const
{
	if (!name || !value)
		return B_ERROR;
	
	BString str(name);
	PProperty *prop = FindProperty(name,index);
	if (!prop)
		return B_NAME_NOT_FOUND;
	
	BTextView *backend = (BTextView*)fView;

	if (backend->Window())
		backend->Window()->Lock();

	if (str.ICompare("LineCount") == 0)
		((IntProperty*)prop)->SetValue(backend->CountLines());
	else if (str.ICompare("Selectable") == 0)
		((BoolProperty*)prop)->SetValue(backend->IsSelectable());
	else if (str.ICompare("CurrentLine") == 0)
		((IntProperty*)prop)->SetValue(backend->CurrentLine());
	else if (str.ICompare("TabWidth") == 0)
		((FloatProperty*)prop)->SetValue(backend->TabWidth());
	else if (str.ICompare("TextRect") == 0)
		((RectProperty*)prop)->SetValue(backend->TextRect());
	else if (str.ICompare("MaxBytes") == 0)
		((IntProperty*)prop)->SetValue(backend->MaxBytes());
	else if (str.ICompare("UseWordWrap") == 0)
		((BoolProperty*)prop)->SetValue(backend->DoesWordWrap());
	else if (str.ICompare("HideTyping") == 0)
		((BoolProperty*)prop)->SetValue(backend->IsTypingHidden());
	else if (str.ICompare("Editable") == 0)
		((BoolProperty*)prop)->SetValue(backend->IsEditable());
	else if (str.ICompare("ColorSpace") == 0)
		((IntProperty*)prop)->SetValue(backend->ColorSpace());
	else if (str.ICompare("TextLength") == 0)
		((IntProperty*)prop)->SetValue(backend->TextLength());
	else if (str.ICompare("Text") == 0)
		((StringProperty*)prop)->SetValue(backend->Text());
	else if (str.ICompare("Resizable") == 0)
		((BoolProperty*)prop)->SetValue(backend->IsResizable());
	else if (str.ICompare("Alignment") == 0)
		((EnumProperty*)prop)->SetValue(backend->Alignment());
	else if (str.ICompare("Undoable") == 0)
		((BoolProperty*)prop)->SetValue(backend->DoesUndo());
	else if (str.ICompare("AutoIndent") == 0)
		((BoolProperty*)prop)->SetValue(backend->DoesAutoindent());
	else if (str.ICompare("Stylable") == 0)
		((BoolProperty*)prop)->SetValue(backend->IsStylable());
	else
	{
		if (backend->Window())
			backend->Window()->Unlock();

		return PView::GetProperty(name, value, index);
	}

	if (backend->Window())
		backend->Window()->Unlock();

	return prop->GetValue(value);
}
开发者ID:HaikuArchives,项目名称:PDesigner,代码行数:63,代码来源:PTextView.cpp

示例14: GetObject

PObjectBase XrcLoader::GetObject( ticpp::Element *xrcObj, PObjectBase parent )
{
	// First, create the object by the name, the modify the properties

	std::string className = xrcObj->GetAttribute( "class" );
	if ( parent->GetObjectTypeName() == wxT( "project" ) )
	{
		if ( className == "wxBitmap" )
		{
			PProperty bitmapsProp = parent->GetProperty( _( "bitmaps" ) );
			if ( bitmapsProp )
			{
				wxString value = bitmapsProp->GetValue();
				wxString text = _WXSTR( xrcObj->GetText() );
				text.Replace( wxT( "\'" ), wxT( "\'\'" ), true );
				value << wxT( "\'" ) << text << wxT( "\' " );
				bitmapsProp->SetValue( value );
				return PObjectBase();
			}
		}
		if ( className == "wxIcon" )
		{
			PProperty iconsProp = parent->GetProperty( _( "icons" ) );
			if ( iconsProp )
			{
				wxString value = iconsProp->GetValue();
				wxString text = _WXSTR( xrcObj->GetText() );
				text.Replace( wxT( "\'" ), wxT( "\'\'" ), true );
				value << wxT( "\'" ) << text << wxT( "\' " );
				iconsProp->SetValue( value );
				return PObjectBase();
			}
		}

		// Forms wxPanel, wxFrame, wxDialog are stored internally as Panel, Frame, and Dialog
		// to prevent conflicts with wxPanel as a container
		className = className.substr( 2, className.size() - 2 );
	}

	// Well, this is not nice. wxMenu class name is ambiguous, so we'll get the
	// correct class by the context. If the parent of a wxMenu is another wxMenu
	// then the class name will be "submenu"
	else if ( className == "wxMenu" && ( parent->GetClassName() == wxT( "wxMenu" ) || parent->GetClassName() == wxT( "submenu" ) ) )
	{
		className = "submenu";
	}

	// "separator" is also ambiguous - could be a toolbar separator or a menu separator
	else if ( className == "separator" )
	{
		if ( parent->GetClassName() == wxT( "wxToolBar" ) )
		{
			className = "toolSeparator";
		}
	}

	// replace "spacer" with "sizeritem" so it will be imported as a "sizeritem"
	// "sizeritem" is ambiguous - could also be a grid bag sizeritem
	else if ( className == "spacer" || className == "sizeritem" )
	{
		if ( parent->GetClassName() == wxT( "wxGridBagSizer" ) )
		{
			className = "gbsizeritem";
		}
		else
		{
			className = "sizeritem";
		}
	}

	PObjectBase object;
	PObjectInfo objInfo = m_objDb->GetObjectInfo( _WXSTR( className ) );
	if ( objInfo )
	{
		IComponent *comp = objInfo->GetComponent();
		if ( !comp )
		{
			wxLogError( _("No component found for class \"%s\", found on line %i."), _WXSTR( className ).c_str(), xrcObj->Row() );
		}
		else
		{
			ticpp::Element *fbObj = comp->ImportFromXrc( xrcObj );
			if ( !fbObj )
			{
				wxLogError( _("ImportFromXrc returned NULL for class \"%s\", found on line %i."), _WXSTR( className ).c_str(), xrcObj->Row() );
			}
			else
			{
				object = m_objDb->CreateObject( fbObj, parent );
				if ( !object )
				{
					// Unable to create the object and add it to the parent - probably needs a sizer
					PObjectBase newsizer = m_objDb->CreateObject( "wxBoxSizer", parent );
					if ( newsizer )
					{
						// It is possible the CreateObject returns an "item" containing the object, e.g. SizerItem or SplitterItem
						// If that is the case, reassign "object" to the actual object
						PObjectBase sizer = newsizer;
						if ( sizer->GetChildCount() > 0 )
						{
//.........这里部分代码省略.........
开发者ID:idrassi,项目名称:wxFormBuilder,代码行数:101,代码来源:xrcfilter.cpp

示例15: PropertyToCode

/**
 * Convierte el valor de una propiedad a código C++.
 */
string CppTemplateParser::PropertyToCode(PProperty property)
{
  PropertyType type = property->GetType();
  string value = property->GetValue();
  
  string result;
  
  switch (type)
  {
    case PT_WXSTRING:
    // TO-DO's
    // Las cadenas de caracteres (wxString) hay que pasarlas a cadenas tipo "C"
    // "Hola" -> wxT("\"Hola\"")
      result = "wxT(\"" + ConvertCppString(value) + "\")"; 
      break;
    case PT_MACRO:
    case PT_TEXT:
    case PT_OPTION:
      result = value;
      break;
    case PT_BITLIST:
      if (value == "")
        result = "0";
      else
        result = value;
      break;
    case PT_WXPOINT:
      if (value == "")
        result = "wxDefaultPosition";
      else
        result = "wxPoint(" + value + ")";
      break;
    case PT_WXSIZE:
      if (value == "")
        result = "wxDefaultSize";
      else
        result = "wxSize(" + value + ")";
      break;
    case PT_BOOL:
      if (value == "0")
        result = "false";
      else
        result = "true";
      break;
    case PT_WXFONT:
      if (value != "")
      {
        wxFont font = 
          TypeConv::StringToFont(wxString(value.c_str(),wxConvUTF8));
        
        wxString underlined(wxT("false"));
        if (font.GetUnderlined())
          underlined = wxT("true");
 
        wxString font_str = wxString::Format(wxT("wxFont(%d,%d,%d,%d,%s,wxT(\"%s\"))"),
                             font.GetPointSize(),
                             font.GetFamily(),
                             font.GetStyle(),
                             font.GetWeight(),
                             underlined.c_str(),
                             font.GetFaceName().c_str());
        result = string(font_str.mb_str());
      }
      else
        result = "wxFont()";
      break;  
    case PT_WXCOLOUR:
      if (value != "") 
      {
        wxColour colour = 
          TypeConv::StringToColour(wxString(value.c_str(),wxConvUTF8));
          
        wxString col_str = wxString::Format(wxT("wxColour(%d,%d,%d)"),
                             colour.Red(),colour.Green(),colour.Blue());
        result = string(col_str.mb_str());
        
      }
      else 
          result = "wxColour()";
       
      break;  
      
    case PT_BITMAP:
      // La generación de esta propiedad es provisional ya que la idea
      // principal es que los archivos xpm se incluyan (#include) en el
      // fichero cpp y no cargarlo de un fichero.
      result = "wxBitmap(wxT(\"" + ConvertCppString(value)
                       + "\"), wxBITMAP_TYPE_XPM)";
      break;
    default:
      
      break;  
  }
  
  return result;
}
开发者ID:idrassi,项目名称:wxFormBuilder,代码行数:99,代码来源:cppcg.cpp


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