本文整理汇总了C++中PProperty类的典型用法代码示例。如果您正苦于以下问题:C++ PProperty类的具体用法?C++ PProperty怎么用?C++ PProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: str
status_t
PListView::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;
BListView *backend = (BListView*)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();
else if (str.ICompare("SelectionMessage") == 0)
{
BMessage selMsg(*intval.value);
backend->SetSelectionMessage(&selMsg);
}
else if (str.ICompare("InvocationMessage") == 0)
{
BMessage invMsg(*intval.value);
backend->SetInvocationMessage(&invMsg);
}
else if (str.ICompare("SelectionType") == 0)
{
prop->GetValue(&intval);
backend->SetListType((list_view_type)*intval.value);
}
else
{
if (backend->Window())
backend->Window()->Unlock();
return PView::SetProperty(name, value, index);
}
if (backend->Window())
backend->Window()->Unlock();
return prop->GetValue(value);
}
示例2: str
status_t
PLabel::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;
BStringView *backend = (BStringView*)fView;
if (backend->Window())
backend->Window()->Lock();
if (str.ICompare("Alignment") == 0)
((EnumProperty*)prop)->SetValue(backend->Alignment());
else if (str.ICompare("Text") == 0)
((StringProperty*)prop)->SetValue(backend->Text());
else
{
if (backend->Window())
backend->Window()->Unlock();
return PView::GetProperty(name, value, index);
}
if (backend->Window())
backend->Window()->Unlock();
return prop->GetValue(value);
}
示例3: str
status_t
PControl::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;
if (!fView)
return B_NO_INIT;
BControl *viewAsControl = (BControl*)fView;
if (str.ICompare("Enabled") == 0)
((BoolProperty*)prop)->SetValue(viewAsControl->IsEnabled());
else if (str.ICompare("Label") == 0)
((StringProperty*)prop)->SetValue(viewAsControl->Label());
else if (str.ICompare("Value") == 0)
((IntProperty*)prop)->SetValue(viewAsControl->Value());
else
return PView::GetProperty(name,value,index);
return prop->GetValue(value);
}
示例4: ParsePropertyName
bool TemplateParser::ParseProperty()
{
wxString childName;
wxString propname = ParsePropertyName( &childName );
PProperty property = m_obj->GetProperty(propname);
if ( NULL == property.get() )
{
wxLogError( wxT("The property '%s' does not exist for objects of class '%s'"), propname.c_str(), m_obj->GetClassName().c_str() );
return true;
}
if ( childName.empty() )
{
wxString code = PropertyToCode(property);
m_out << code;
}
else
{
m_out << property->GetChildFromParent( childName );
}
// LogDebug("parsing property %s",propname.c_str());
return true;
}
示例5: 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 );
}
}
示例6: n_error
CProperty* CEntityFactory::AttachProperty(CEntity& Entity, const nString& TypeName) const
{
CPropertyInfo PropInfo;
nString Type = TypeName;
if (!PropertyMeta.Get(Type.Get(), PropInfo))
{
Type = StrPropPrefix + TypeName;
if (!PropertyMeta.Get(Type.Get(), PropInfo))
n_error("No such property \"%s\"", TypeName.Get());
}
n_assert(PropInfo.pStorage);
if (PropInfo.ActivePools & Entity.GetEntityPool())
{
PProperty Prop;
if (!PropInfo.pStorage->Get(Entity.GetUniqueID(), Prop))
{
Prop = (CProperty*)CoreFct->Create(Type);
PropInfo.pStorage->Add(Entity.GetUniqueID(), Prop);
Prop->SetEntity(&Entity);
}
return Prop.get_unsafe();
}
return NULL;
}
示例7: element
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;
}
示例8: wxparent
bool TemplateParser::ParseWxParent()
{
PObjectBase wxparent( GetWxParent() );
if ( wxparent )
{
PProperty property = GetRelatedProperty( wxparent );
//m_out << PropertyToCode(property);
if (wxparent->GetClassName() == wxT("wxStaticBoxSizer"))
{
// We got a wxStaticBoxSizer as parent, use the special PT_WXPARENT_SB type to
// generate code to get its static box
m_out << ValueToCode(PT_WXPARENT_SB, property->GetValue());
}
else
{
m_out << ValueToCode(PT_WXPARENT, property->GetValue());
}
}
else
{
ignore_whitespaces();
ParsePropertyName();
m_out << RootWxParentToCode();
}
return true;
}
示例9: 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);
}
示例10: strToCString
//ru Возвращает значение свойства в виде C строки.
EXPORT const char *propToString(quintptr id_prop)
{
PProperty p = m_model->getPropertyById(id_prop);
if (!p)
return 0;
return fcgt::strToCString(p->toString());
}
示例11: propToReal
//ru Возвращает значение свойства в формате float.
EXPORT qreal propToReal(quintptr id_prop)
{
PProperty p = m_model->getPropertyById(id_prop);
if (!p)
return 0;
return p->toReal();
}
示例12: propToInteger
//ru Возвращает значение свойства в формате int.
EXPORT int propToInteger(quintptr id_prop)
{
PProperty p = m_model->getPropertyById(id_prop);
if (!p)
return 0;
return p->toInt();
}
示例13: propToByte
//ru Возвращает значение свойства в формате uchar.
EXPORT uchar propToByte(quintptr id_prop)
{
PProperty p = m_model->getPropertyById(id_prop);
if (!p)
return 0;
return p->toByte();
}
示例14: GetProperty
wxString ObjectBase::GetChildFromParentProperty( const wxString& parentName, const wxString& childName )
{
PProperty property = GetProperty( parentName );
if (property)
return property->GetChildFromParent( childName );
else
return wxEmptyString;
}
示例15: propGetType
//!~~~~~~~~~~~~~~~~~~~~~~~~ свойства элемента ~~~~~~~~~~~~~~~~~~~~~~~~~~
//ru Возвращает тип свойства.
EXPORT DataType propGetType(quintptr id_prop)
{
PProperty p = m_model->getPropertyById(id_prop);
if (!p)
return data_null;
return p->getType();
}