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


C++ Property::GetType方法代码示例

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


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

示例1: SetProperty

//----------------------------------------------------------------
void PropertyList::SetProperty(const wxString& propname, const Property& prop)
/**
 * \brief Sets the property with the given name. If the property does
 * not exists the property will be created. If the property already exists
 * the property will be overridden.
 * \param propname The property name.
 * \param prop The property.
 **/
{
    Property* setprop = GetProperty(propname, true);
    if (setprop->GetType() != prop.GetType())
    {
        setprop->SetType(prop.GetType());
        setprop->SetName(prop.GetName());
    }
    switch (setprop->GetType())
    {
        case penvPT_Boolean:
            setprop->SetBoolean(prop.GetBoolean());
        break;
        case penvPT_Integer:
            setprop->SetInteger(prop.GetInteger());
        break;
        case penvPT_Double:
            setprop->SetDouble(prop.GetDouble());
        break;
        case penvPT_String:
            setprop->SetString(prop.GetString());
        break;
        case penvPT_Properties:
            setprop->SetPropertyList(prop.GetPropertyList());
        break;
        case penvPT_ArrayBoolean:
            NOT_IMPLEMENTED_YET();
        break;
        case penvPT_ArrayInteger:
            NOT_IMPLEMENTED_YET();
        break;
        case penvPT_ArrayDouble:
            NOT_IMPLEMENTED_YET();
        break;
        case penvPT_ArrayString:
            NOT_IMPLEMENTED_YET();
        break;
        default:
            wxString msg = wxString::Format(_T("Unknown type for property %s."), setprop->GetName().c_str());
        break;
    }
}
开发者ID:Sneedd,项目名称:penv,代码行数:50,代码来源:propertylist.cpp

示例2: Set

//----------------------------------------------------------------
void PropertyList::Set(const wxString& propname, const wxString& value)
/**
 * \brief Sets the string value of a known property. If the
 * property does not exists it will be created. If the property
 * exists and has the worng type, it will be overridden and a warning
 * will be created.
 * \param propname The property name.
 * \param value Value to set for the property.
 **/
{
    Property* prop = GetProperty(propname, true);
    if (prop->GetType() == penvPT_None) prop->SetType(penvPT_String);
    prop->SetString(value);
}
开发者ID:Sneedd,项目名称:penv,代码行数:15,代码来源:propertylist.cpp

示例3: GetType

//----------------------------------------------------------------
PropertyType PropertyList::GetType(const wxString& propname)
/**
 * \brief Returns the type of the property. This method will
 * return penvPT_None if the property does not exists and an
 * error will be generated.
 * Use slash to separate one property from another.
 * \param propname The property name.
 * \return Type of the property (see PropertyType enumerator).
 **/
{
    Property* prop = GetProperty(propname, false);
    if (unlikely(prop == NULL)) return (penvPT_None);
    return (prop->GetType());
}
开发者ID:Sneedd,项目名称:penv,代码行数:15,代码来源:propertylist.cpp

示例4: GetProperties

//----------------------------------------------------------------
wxArrayString* PropertyList::GetProperties(bool recursive)
/**
 * \brief Returns all property names from this PropertyList.
 * If the parameter 'recursive' is true all properties will be
 * recursively inserted into the returning string array, with
 * a slash who separates every property from one level to another.
 * If 'recursive' is false only the properties from this level
 * are returned.
 * \param recursive True if all properties should be returned.
 * \return String array with property names.
 **/
{
    // Array erzeugen
    wxArrayString* array = new wxArrayString();
    array->Alloc(m_hashmap->size());
    // Durch Hashmap durchschleifen
    PropertiesHashMap::iterator itr;
    //if (m_hashmap->size() <= 0) return (array);
    for (itr = m_hashmap->begin(); itr != m_hashmap->end(); itr++)
    {
        // Properties in Array speichern
        array->Add(itr->first);
        // Überprüfen ob rekursiv die Properties geholt werden müssen
        Property* prop = itr->second;
        if (recursive && prop->GetType() == penvPT_Properties)
        {
            // Rekursiv aufrufen
            wxArrayString* recarray = prop->GetPropertyList()->GetProperties(recursive);
            for (size_t i=0; i<recarray->Count(); ++i)
            {
                wxString strg = itr->first;
                strg.Append('/').Append(recarray->Item(i).c_str());
                array->Add(strg);
            }
            delete recarray;
        }
    }
    return (array);
}
开发者ID:Sneedd,项目名称:penv,代码行数:40,代码来源:propertylist.cpp


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