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


C++ PropertyValue类代码示例

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


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

示例1: getPropertyRecursively

void PropertyNode::setStr( const std::string &name, const std::string &val ) const{
	PropertyValue *property = getPropertyRecursively( name );
	if (!property) {
		throw std::runtime_error( "Value not exists: " + name );
	}
	return property->setStr(val);
}
开发者ID:jgrande,项目名称:ginga,代码行数:7,代码来源:propertynode.cpp

示例2: _IgnoreActorsToProp

bool _IgnoreActorsToProp(const ClassDefinition *pClass, PCTSTR pszProp, PropertyValue& value)
{
    const SendParam *pSendParam;
    bool fRet = _FindSelfSendParamInInit(pClass, SCIMETHOD_IGNOREACTORS, &pSendParam);
    if (fRet)
    {
        // See what the value is.
        if (pSendParam->HasValue())
        {
            fRet = _GetFirstSimpleValueInCodeSegmentArray(pSendParam->GetSelectorParams(), value);
        }
        if (!fRet)
        {
            // "ignoreActors()"
            // No params means yes, ignore actors.
            value.SetValue(1);
            fRet = true;
        }
    }
    else
    {
        // We didn't find any call to ignoreActors.  By default actors are not ignored.
        // (Actually, it would depend on bit $4000 of the signal property technically)
        value.SetValue(0);
        fRet = true;
    }
    return fRet;
}
开发者ID:OmerMor,项目名称:SciCompanion,代码行数:28,代码来源:SCIProps.cpp

示例3: shallowCopyDataBack

void shallowCopyDataBack(const std::vector<unsigned int> & stateful_prop_ids, MaterialProperties & data, MaterialProperties & data_from)
{
  for (unsigned int i=0; i<stateful_prop_ids.size(); ++i)
  {
    PropertyValue * prop = data[i];                                 // do the look-up just once (OPT)
    PropertyValue * prop_from = data_from[stateful_prop_ids[i]];    // do the look-up just once (OPT)
    if (prop != NULL && prop_from != NULL)
      prop->swap(prop_from);
  }
}
开发者ID:JasonTurner56,项目名称:ARL,代码行数:10,代码来源:MaterialPropertyStorage.C

示例4: shallowCopyData

/**
 * Shallow copy the material properties
 * @param stateful_prop_ids List of IDs with properties to shallow copy
 * @param data Destination data
 * @param data_from Source data
 */
void
shallowCopyData(const std::vector<unsigned int> & stateful_prop_ids,
                MaterialProperties & data,
                MaterialProperties & data_from)
{
  for (unsigned int i = 0; i < stateful_prop_ids.size(); ++i)
  {
    if (i >= data_from.size() || stateful_prop_ids[i] >= data.size())
      continue;
    PropertyValue * prop = data[stateful_prop_ids[i]]; // do the look-up just once (OPT)
    PropertyValue * prop_from = data_from[i];          // do the look-up just once (OPT)
    if (prop != nullptr && prop_from != nullptr)
      prop->swap(prop_from);
  }
}
开发者ID:FHilty,项目名称:moose,代码行数:21,代码来源:MaterialPropertyStorage.C

示例5: NS_ASSERTION

void
FramePropertyTable::Set(nsIFrame* aFrame, const FramePropertyDescriptor* aProperty,
                        void* aValue)
{
  NS_ASSERTION(aFrame, "Null frame?");
  NS_ASSERTION(aProperty, "Null property?");

  if (mLastFrame != aFrame || !mLastEntry) {
    mLastFrame = aFrame;
    mLastEntry = mEntries.PutEntry(aFrame);
  }
  Entry* entry = mLastEntry;

  if (!entry->mProp.IsArray()) {
    if (!entry->mProp.mProperty) {
      // Empty entry, so we can just store our property in the empty slot
      entry->mProp.mProperty = aProperty;
      entry->mProp.mValue = aValue;
      return;
    }
    if (entry->mProp.mProperty == aProperty) {
      // Just overwrite the current value
      entry->mProp.DestroyValueFor(aFrame);
      entry->mProp.mValue = aValue;
      return;
    }

    // We need to expand the single current entry to an array
    PropertyValue current = entry->mProp;
    entry->mProp.mProperty = nullptr;
    static_assert(sizeof(nsTArray<PropertyValue>) <= sizeof(void *),
                  "Property array must fit entirely within entry->mProp.mValue");
    new (&entry->mProp.mValue) nsTArray<PropertyValue>(4);
    entry->mProp.ToArray()->AppendElement(current);
  }

  nsTArray<PropertyValue>* array = entry->mProp.ToArray();
  nsTArray<PropertyValue>::index_type index =
    array->IndexOf(aProperty, 0, PropertyComparator());
  if (index != nsTArray<PropertyValue>::NoIndex) {
    PropertyValue* pv = &array->ElementAt(index);
    pv->DestroyValueFor(aFrame);
    pv->mValue = aValue;
    return;
  }

  array->AppendElement(PropertyValue(aProperty, aValue));
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:48,代码来源:FramePropertyTable.cpp

示例6: _AddToPicToProp

bool _AddToPicToProp(const ClassDefinition *pClass, PCTSTR pszProp, PropertyValue& value)
{
    const SendParam *pSendParam;
    // This only depends on whether we found an addToPic call
    value.SetValue(_FindSelfSendParamInInit(pClass, SCIMETHOD_ADDTOPIC, &pSendParam) ? 1 : 0);
    return true;
}
开发者ID:OmerMor,项目名称:SciCompanion,代码行数:7,代码来源:SCIProps.cpp

示例7: throw

  void
  NotifConfig::load()
  throw (NotifConfig::GeneralConfigError)
  {
    string filename = get_storage_filename();

    fstream file(filename.c_str(), ios::in);

    if (!file.good())
    {
      string msg = "cannot open config file '";
      msg.append(filename + "' for loading");
      throw NotifConfig::GeneralConfigError(msg);
    }

    string line,head,tail;
    int n;
    getline(file, line);
    while (!file.eof())
    {
      if (line == "")
        continue;
      n = line.find(" ");
      head = line.substr(0, n);
      tail = line.substr(n + 1);
      try
      {
        PropertyValue * value = find(head);
        value->from_string(tail);
      }
      catch (PropertyNotFound & e)
      {
        string msg = "cannot load config from disk: key '";
        msg.append(e.property_name + "' not found");
        throw GeneralConfigError(msg);
      }
      catch (PropertyValue::InvalidStringFormat & e)
      {
        string msg = "cannot load config from disk: key '";
        msg.append(head + "' cannot be correctly interpreted");
        throw GeneralConfigError(msg);
      }
      getline(file,line);
    }
    file.close();
  }
开发者ID:AlvaroVega,项目名称:TIDNotifC,代码行数:46,代码来源:NotifConfig.C

示例8: setValue

static void setValue(void *dst, valuetype_t dstType, PropertyValue const &pvalue)
{
    switch (dstType)
    {
    case DDVT_FIXED:
        *((fixed_t *) dst) = pvalue.asFixed();
        break;
    case DDVT_FLOAT:
        *(  (float *) dst) = pvalue.asFloat();
        break;
    case DDVT_DOUBLE:
        *( (double *) dst) = pvalue.asDouble();
        break;
    case DDVT_BYTE:
        *(   (byte *) dst) = pvalue.asByte();
        break;
    case DDVT_INT:
        *(    (int *) dst) = pvalue.asInt32();
        break;
    case DDVT_SHORT:
        *(  (short *) dst) = pvalue.asInt16();
        break;
    case DDVT_ANGLE:
        *((angle_t *) dst) = pvalue.asAngle();
        break;
    default:
        throw Error("setValue", QString("Unknown value type %d").arg(dstType));
    }
}
开发者ID:skyjake,项目名称:Doomsday-Engine,代码行数:29,代码来源:entitydef.cpp

示例9: SetProp

void Portal::SetProp(PropertyKey key, PropertyValue value)
{
  Trigger::SetProp(key, value);
  switch (key)
  {
  case PROP_DEST_ID:
    m_destId = value.GetInt();
  }
}
开发者ID:jason-amju,项目名称:amju-ww,代码行数:9,代码来源:Portal.cpp

示例10: main

int main()
{
   {
	  testcallback tcb;
	  string p("/a/bb/ccc/dddd/eeeee/ffffff");
	  cout << " print #1" << endl;
	  mgr.print();
	  
	  PropertyValue * p1 = mgr.addLeaf("/test/wholenumber");
	  p1->set(17);
	  PropertyValue * p2;
	  (p2 = mgr.addLeaf("/lesser/floatno"))->set(-0.334f);
	  PropertyValue * p3;
	  (p3 = mgr.addLeaf("/dict/text/str"))->set(string("laber"));
	  //PropertyValue * nd =
	                        mgr.addLeaf("/i/am/notdefined");
	  PropertyValue * p4;
	  (p4 = mgr.addLeaf("/logical/notlogic/MisterBoole"))->set(true);
	  cout << " print #2" << endl;
	  mgr.print();
	  p1->registerOnChange(&tcb);
	  p1->set(99);
	  
	  cout << " print #3" << endl;
	  mgr.print();
//	  PropertyValue * r0 = 
                            mgr.get("/this/does/not/exist");
	  PropertyValue * r1 = mgr.get("/test/wholenumber");
	  PropertyValue * notdef = mgr.get("/i/am/notdefined");
	  notdef->set(false);
	  cout << "getPath test: " << p1->getPath() << endl;
	  cout << "\\\\\\\\\\\\\\" << "comparing p1 and r1: p1=" << &p1 << "  r1=" << r1 << endl;
	  r1->set(23);
	  PropertyValue * r3 = mgr.get("/dict/text/str");
	  r3->set(string("unit TESTING in progress..."));
	  
	  mgr.run();

	  cout << " print #4" << endl;
	  mgr.print();
   }
   
   exit(0);
}
开发者ID:jetmaint,项目名称:phcc,代码行数:44,代码来源:varmgrtest.cpp

示例11: VERIFY

Variant GetDPByExpExpression::Evaluate(Expressive::EvalContext* context)
{
	Object* obj = m_object->Evaluate(context);
	DependencyObject* depObj = dynamic_cast<DependencyObject*>(obj);
	if (depObj == NULL)
	{
		VERIFY(0);
	}
	Variant propertyRef = m_exp->Evaluate(context);

	PropertyValue* pProperty;

	if (propertyRef.IsString())
		pProperty = depObj->GetProperty(depObj->GetClass()->GetLocalProperty(propertyRef.ToString()));
	else if (propertyRef.IsInt())
		pProperty = depObj->GetProperty(depObj->GetClass()->GetLocalProperty((int)propertyRef));
	else
		throw new Exception("property not found");

	return pProperty->GetComputedValue();
}
开发者ID:sigurdle,项目名称:FirstProject2,代码行数:21,代码来源:GetDPByExpExpression.cpp

示例12: _PriorityClassToProp

bool _PriorityClassToProp(const ClassDefinition *pClass, PCTSTR pszProp, PropertyValue& value)
{
    const SendParam *pSendParam;
    bool fRet = _FindSelfSendParamInInit(pClass, SCIMETHOD_SETPRI, &pSendParam);
    if (fRet)
    {
        // See what the value is.
        if (pSendParam->HasValue())
        {
            fRet = _GetFirstSimpleValueInCodeSegmentArray(pSendParam->GetSelectorParams(), value);
        }
    }
    if (!fRet)
    {
        // We didn't find anything.  The default value for priority tends to be zero, but that isn't
        // accurate.  It depends on the signal property.
        // Instead we'll use -1 as a sentinel value indicating "default priority".
        value.SetValue((WORD)-1);
        fRet = true;
    }
    return fRet;
}
开发者ID:OmerMor,项目名称:SciCompanion,代码行数:22,代码来源:SCIProps.cpp

示例13: if

std::vector<FontStack> Parser::fontStacks() const {
    std::set<FontStack> result;

    for (const auto& layer : layers) {
        if (layer->is<SymbolLayer>()) {
            PropertyValue<FontStack> textFont = layer->as<SymbolLayer>()->getTextFont();
            if (textFont.isUndefined()) {
                result.insert({"Open Sans Regular", "Arial Unicode MS Regular"});
            } else if (textFont.isConstant()) {
                result.insert(textFont.asConstant());
            } else if (textFont.isFunction()) {
                for (const auto& stop : textFont.asFunction().getStops()) {
                    result.insert(stop.second);
                }
            }
        }
    }

    return std::vector<FontStack>(result.begin(), result.end());
}
开发者ID:OrdnanceSurvey,项目名称:mapbox-gl-native,代码行数:20,代码来源:parser.cpp

示例14: if

std::vector<FontStack> Parser::fontStacks() const {
    std::set<FontStack> optional;

    for (const auto& layer : layers) {
        if (layer->is<SymbolLayer>()) {
            PropertyValue<FontStack> textFont = layer->as<SymbolLayer>()->getTextFont();
            if (textFont.isUndefined()) {
                optional.insert({"Open Sans Regular", "Arial Unicode MS Regular"});
            } else if (textFont.isConstant()) {
                optional.insert(textFont.asConstant());
            } else if (textFont.isCameraFunction()) {
                textFont.asCameraFunction().stops.match(
                    [&] (const auto& stops) {
                        for (const auto& stop : stops.stops) {
                            optional.insert(stop.second);
                        }
                    }
                );
            }
        }
    }

    return std::vector<FontStack>(optional.begin(), optional.end());
}
开发者ID:iosphere,项目名称:mapbox-gl-native,代码行数:24,代码来源:parser.cpp

示例15: evaluate

float evaluate(PropertyValue<float> value, float zoom) {
    return value.evaluate(PropertyEvaluator<float>(PropertyEvaluationParameters(zoom), 0));
}
开发者ID:eden57,项目名称:mapbox-gl-native,代码行数:3,代码来源:functions.test.cpp


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