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


C++ PropertyBase类代码示例

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


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

示例1: onPropertySelected

void VisualizationPanel::onPropertySelected( wxPropertyGridEvent& event )
{
  wxPGProperty* pg_property = event.GetProperty();

  selected_display_ = NULL;

  if ( !pg_property )
  {
    return;
  }

  void* client_data = pg_property->GetClientData();
  if ( client_data )
  {
    PropertyBase* property = reinterpret_cast<PropertyBase*>(client_data);

    void* user_data = property->getUserData();
    if ( user_data )
    {
      Display* display = reinterpret_cast<Display*>(user_data);

      if ( manager_->isValidDisplay( display ) )
      {
        selected_display_ = display;
      }
    }
  }
}
开发者ID:janfrs,项目名称:kwc-ros-pkg,代码行数:28,代码来源:visualization_panel.cpp

示例2: tpGetPropertyType

char* tlp_cc tpGetPropertyType(TELHandle handle)
{
    start_try
        PropertyBase* para = castHandle<PropertyBase>(handle, __FUNC__);
        return tlp::createText(para->getType());
    catch_ptr_macro
}
开发者ID:alexdarling,项目名称:telPlugins,代码行数:7,代码来源:telplugins_properties_api.cpp

示例3: tpGetPropertyValueHandle

void* tlp_cc tpGetPropertyValueHandle(TELHandle handle)
{
    start_try
        PropertyBase* para = castHandle<PropertyBase>(handle, __FUNC__);
        return para->getValueHandle();
    catch_ptr_macro
}
开发者ID:alexdarling,项目名称:telPlugins,代码行数:7,代码来源:telplugins_properties_api.cpp

示例4: assert

PropertyBase * Entity::setAttr(const std::string & name, const Element & attr)
{
    PropertyBase * prop;
    // If it is an existing property, just update the value.
    PropertyDict::const_iterator I = m_properties.find(name);
    if (I != m_properties.end()) {
        prop = I->second;
        // Mark it as unclean
        prop->resetFlags(per_clean);
    } else {
        PropertyDict::const_iterator I;
        if (m_type != 0 &&
            (I = m_type->defaults().find(name)) != m_type->defaults().end()) {
            prop = I->second->copy();
        } else {
            // This is an entirely new property, not just a modifcation of
            // one in defaults, so we need to install it to this Entity.
            prop = PropertyManager::instance()->addProperty(name,
                                                            attr.getType());
            prop->install(this, name);
        }
        assert(prop != 0);
        m_properties[name] = prop;
    }

    prop->set(attr);
    // Allow the value to take effect.
    prop->apply(this);
    // Mark the Entity as unclean
    resetFlags(entity_clean);
    return prop;
}
开发者ID:cyclefusion,项目名称:cyphesis,代码行数:32,代码来源:Entity.cpp

示例5: tpSetPropertyHint

bool tlp_cc tpSetPropertyHint(TELHandle handle, const char* value)
{
    start_try
        PropertyBase* para = castHandle<PropertyBase>(handle, __FUNC__);
        para->setHint(string(value));
        return true;
    catch_bool_macro
}
开发者ID:alexdarling,项目名称:telPlugins,代码行数:8,代码来源:telplugins_properties_api.cpp

示例6: tpGetPropertyValueAsString

char* tlp_cc tpGetPropertyValueAsString(TELHandle handle)
{
    start_try
        PropertyBase* para = castHandle<PropertyBase>(handle, __FUNC__);
        string val = para->getValueAsString();
        return tlp::createText(val);
    catch_ptr_macro
}
开发者ID:alexdarling,项目名称:telPlugins,代码行数:8,代码来源:telplugins_properties_api.cpp

示例7: tpGetPropertyInfo

char* tlp_cc tpGetPropertyInfo(TELHandle handle)
{
    start_try
        PropertyBase* para = castHandle<PropertyBase>(handle, __FUNC__);
        stringstream s;
        s<<"Name="<<para->getName()<<"\tType="<<para->getType()<<"\tDescription="<<para->getDescription()<<"\tHint="<<para->getHint();
        return tlp::createText(s.str());
    catch_ptr_macro
}
开发者ID:alexdarling,项目名称:telPlugins,代码行数:9,代码来源:telplugins_properties_api.cpp

示例8: Entity_setattro

static int Entity_setattro(PyEntity *self, PyObject *oname, PyObject *v)
{
#ifndef NDEBUG
    if (self->m_entity.e == NULL) {
        PyErr_SetString(PyExc_AssertionError, "NULL entity in Entity.setattr");
        return -1;
    }
#endif // NDEBUG
    char * name = PyString_AsString(oname);
    if (strcmp(name, "map") == 0) {
        PyErr_SetString(PyExc_AttributeError, "map attribute forbidden");
        return -1;
    }
    Entity * entity = self->m_entity.e;
    //std::string attr(name);
    //if (v == NULL) {
        //entity->attributes.erase(attr);
        //return 0;
    //}
    if (strcmp(name, "type") == 0) {
        if (entity->getType() != 0) {
            PyErr_SetString(PyExc_RuntimeError, "Cannot mutate entity type");
            return -1;
        }
        if (!PyString_CheckExact(v)) {
            PyErr_SetString(PyExc_TypeError, "No string type");
            return -1;
        }
        const TypeNode * type = Inheritance::instance().getType(PyString_AsString(v));
        if (type == 0) {
            PyErr_SetString(PyExc_RuntimeError, "Entity type unknown");
            return -1;
        }
        entity->setType(type);
        return 0;
    }
    Element obj;
    if (PyObject_asMessageElement(v, obj) == 0) {
        PropertyBase * p = entity->setAttr(name, obj);
        if (p != 0) {
            p->setFlags(flag_unsent);
        }
        return 0;
    }
    // FIXME In fact it seems that nothing currently hits this bit, so
    // all this code is redundant for entity scripts.
    // If we get here, then the attribute is not Atlas compatable, so we
    // need to store it in a python dictionary
    if (self->Entity_attr == NULL) {
        self->Entity_attr = PyDict_New();
        if (self->Entity_attr == NULL) {
            return -1;
        }
    }
    return PyDict_SetItemString(self->Entity_attr, name, v);
}
开发者ID:erikogenvik,项目名称:cyphesis,代码行数:56,代码来源:Py_Thing.cpp

示例9: updateEntity

void StorageManager::updateEntity(LocatedEntity * ent)
{
    std::string location;
    Atlas::Message::MapType map;
    map["pos"] = ent->m_location.pos().toAtlas();
    if (ent->m_location.orientation().isValid()) {
        map["orientation"] = ent->m_location.orientation().toAtlas();
    }
    Database::instance()->encodeObject(map, location);

    //Under normal circumstances only the top world won't have a location.
    if (ent->m_location.m_loc) {
        Database::instance()->updateEntity(ent->getId(),
                                       ent->getSeq(),
                                       location,
                                       ent->m_location.m_loc->getId());
    } else {
        Database::instance()->updateEntityWithoutLoc(ent->getId(),
                                       ent->getSeq(),
                                       location);
    }
    ++m_updateEntityCount;
    KeyValues new_property_tuples;
    KeyValues upd_property_tuples;
    const PropertyDict & properties = ent->getProperties();
    PropertyDict::const_iterator I = properties.begin();
    PropertyDict::const_iterator Iend = properties.end();
    for (; I != Iend; ++I) {
        PropertyBase * prop = I->second;
        if (prop->flags() & per_mask) {
            continue;
        }
        // FIXME check if this is new or just modded.
        if (prop->flags() & per_seen) {
            encodeProperty(prop, upd_property_tuples[I->first]);
            ++m_updatePropertyCount;
        } else {
            encodeProperty(prop, new_property_tuples[I->first]);
            ++m_insertPropertyCount;
        }
        prop->setFlags(per_clean | per_seen);
    }
    if (!new_property_tuples.empty()) {
        Database::instance()->insertProperties(ent->getId(),
                                               new_property_tuples);
    }
    if (!upd_property_tuples.empty()) {
        Database::instance()->updateProperties(ent->getId(),
                                               upd_property_tuples);
    }
    ent->setFlags(entity_clean);
}
开发者ID:Arsakes,项目名称:cyphesis,代码行数:52,代码来源:StorageManager.cpp

示例10: tpSetPropertyByString

bool tlp_cc tpSetPropertyByString(TELHandle handle, const char* value)
{
    start_try
        PropertyBase* para = castHandle<PropertyBase>(handle, __FUNC__);
        if(value)
        {
            string val(value);
            para->setValueFromString(val);
            return true;
        }
        return false;
    catch_bool_macro
}
开发者ID:alexdarling,项目名称:telPlugins,代码行数:13,代码来源:telplugins_properties_api.cpp

示例11: testAdd

void PropertyExerciser::testAdd(PropertyBase & property,
                                Element::Type element_type)
{
    Anonymous add_target;
    MapType add_target2;
    std::vector<StringType>::const_iterator I = string_values.begin();
    std::vector<StringType>::const_iterator Iend = string_values.end();
    for (; I != Iend; ++I) {
        property.add(*I, add_target);
        property.add(*I, add_target2);
    }

}
开发者ID:erikogenvik,项目名称:cyphesis,代码行数:13,代码来源:PropertyExerciser.cpp

示例12: addProperties

void TypeNode::addProperties(const MapType & attributes)
{
    MapType::const_iterator J = attributes.begin();
    MapType::const_iterator Jend = attributes.end();
    PropertyBase * p;
    for (; J != Jend; ++J) {
        p = PropertyManager::instance()->addProperty(J->first,
                                                     J->second.getType());
        assert(p != 0);
        p->set(J->second);
        p->setFlags(flag_class);
        m_defaults[J->first] = p;
    }
}
开发者ID:9cat,项目名称:cyphesis,代码行数:14,代码来源:TypeNode.cpp

示例13: getPropertyValueHandle

void* Plugin::getPropertyValueHandle(const string& propName)
{
    PropertyBase* prop =  mProperties.getProperty(propName);
    if(prop)
    {
        return prop->getValueHandle();
    }
    else
    {
        stringstream str;
        str<<"No property with name: "<<propName;
        throw(Exception(str.str()));
    }
}
开发者ID:alexdarling,项目名称:telPlugins,代码行数:14,代码来源:telPlugin.cpp

示例14: ASSERT_TRUE

void Entitytest::test_setAttr_new()
{
    ASSERT_TRUE(!m_TestProperty_install_called);

    PropertyBase * pb = m_entity->setAttr("test_int_property", 24);
    ASSERT_NOT_NULL(pb);

    ASSERT_TRUE((pb->flags() & flag_class) == 0);

    auto * int_property = dynamic_cast<TestProperty *>(pb);
    ASSERT_NOT_NULL(int_property);
    ASSERT_EQUAL(int_property->data(), 24);
    ASSERT_TRUE(m_TestProperty_install_called);
    ASSERT_TRUE(m_TestProperty_apply_called);
}
开发者ID:alriddoch,项目名称:cyphesis,代码行数:15,代码来源:Entitytest.cpp

示例15: add_properties

static PyObject * add_properties(PyObject * self, PyEntity * o)
{
    if (!PyEntity_Check(o)) {
        PyErr_SetString(PyExc_TypeError, "Unknown Object type");
        return NULL;
    }

    Entity * ent = o->m_entity.e;
    
    PropertyBase * p = ent->setProperty("terrain", new TerrainProperty);
    p->install(ent, "terrain");
    p->apply(ent);

    Py_INCREF(Py_None);
    return Py_None;
}
开发者ID:alriddoch,项目名称:cyphesis,代码行数:16,代码来源:Py_TerrainPropertytest.cpp


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