Changeset 171 for cpp/frams/util
- Timestamp:
- 03/13/14 01:00:33 (11 years ago)
- Location:
- cpp/frams/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/util/extvalue.cpp
r144 r171 56 56 if (!(subtype&1)) return false; 57 57 if (dbobject->refcount==1) return false; 58 VectorObject* v=VectorObject::fromObject(*this );58 VectorObject* v=VectorObject::fromObject(*this,false); 59 59 if (v) 60 60 { … … 72 72 } 73 73 74 void* ExtObject::getTarget(const char* classname, bool through_barrier ) const74 void* ExtObject::getTarget(const char* classname, bool through_barrier, bool warn) const 75 75 { 76 76 if (!strcmp(interfaceName(),classname)) … … 81 81 BarrierObject *bo=BarrierObject::fromObject(*this); 82 82 if (bo) 83 return bo->getSourceObject().getTarget(classname );83 return bo->getSourceObject().getTarget(classname,true,warn); 84 84 } 85 85 #endif 86 87 if (warn) 88 { 89 FMprintf("ExtValue","getObjectTarget",FMLV_WARN,"%s object expected, %s found",classname,interfaceName()); 90 } 91 86 92 return NULL; 87 93 } … … 173 179 174 180 if (isEmpty()) return SString(); 175 VectorObject *vec=VectorObject::fromObject(*this );181 VectorObject *vec=VectorObject::fromObject(*this,false); 176 182 if (vec) 177 183 return vec->serialize(); 178 DictionaryObject *dic=DictionaryObject::fromObject(*this );184 DictionaryObject *dic=DictionaryObject::fromObject(*this,false); 179 185 if (dic) 180 186 return dic->serialize(); … … 215 221 /////////////////////////////////////// 216 222 223 void *ExtValue::getObjectTarget(const char* classname,bool warn) const 224 { 225 if (type!=TObj) 226 { 227 if (warn) 228 { 229 SString tmp=getString(); 230 if (tmp.len()>30) tmp=tmp.substr(0,30)+"..."; 231 if (type==TString) tmp=SString("\"")+tmp+SString("\""); 232 FMprintf("ExtValue","getObjectTarget",FMLV_WARN,"%s object expected, %s found",classname,(const char*)tmp); 233 } 234 return NULL; 235 } 236 237 return getObject().getTarget(classname,true,warn); 238 } 239 217 240 void ExtValue::set(const ExtValue& src) 218 241 { … … 326 349 case TObj: 327 350 { 328 VectorObject *vec=VectorObject::fromObject(getObject() );329 VectorObject *vec2=VectorObject::fromObject(src.getObject() );351 VectorObject *vec=VectorObject::fromObject(getObject(),false); 352 VectorObject *vec2=VectorObject::fromObject(src.getObject(),false); 330 353 if (vec && vec2) 331 354 { … … 368 391 case TObj: 369 392 { 370 VectorObject *vec=VectorObject::fromObject(getObject() );393 VectorObject *vec=VectorObject::fromObject(getObject(),false); 371 394 if (vec) 372 395 { … … 532 555 case TString: 533 556 { 534 VectorObject *vec=VectorObject::fromObject(src.getObject() );557 VectorObject *vec=VectorObject::fromObject(src.getObject(),false); 535 558 if (vec) 536 559 sdata()=format(sdata(),(const ExtValue**)&vec->data.getref(0),vec->data.size()); … … 815 838 if (cls && (tmp.getType()!=TUnknown) && (tmp.getType()!=TInvalid)) 816 839 { 817 VectorObject *vec=VectorObject::fromObject(tmp.getObject() );840 VectorObject *vec=VectorObject::fromObject(tmp.getObject(),false); 818 841 if (vec) 819 842 { … … 826 849 } 827 850 } 828 DictionaryObject *dic=DictionaryObject::fromObject(tmp.getObject() );851 DictionaryObject *dic=DictionaryObject::fromObject(tmp.getObject(),false); 829 852 if (dic) 830 853 { -
cpp/frams/util/extvalue.h
r144 r171 58 58 bool matchesInterfaceName(ParamInterface* pi) const {return !strcmp(interfaceName(),pi->getName());} 59 59 void* getTarget() const {return (subtype&1)?dbobject:object;} 60 void* getTarget(const char* classname, bool through_barrier=true ) const;60 void* getTarget(const char* classname, bool through_barrier=true, bool warn=true) const; 61 61 void setEmpty() {decref();subtype=0;param=NULL;object=NULL;} 62 62 int isEmpty() const {return !param;} … … 142 142 bool makeUnique() {return (type==TObj) && odata().makeUnique();} //< @return false if nothing has changed 143 143 ExtPType getType() {return type;} 144 void *getObjectTarget(const char* classname ) {return (type==TObj)?getObject().getTarget(classname):0;}144 void *getObjectTarget(const char* classname,bool warn=true) const; 145 145 void setInt(long v) {if (type!=TInt) setri(v); else idata()=v;} 146 146 void setDouble(double v) {if (type!=TDouble) setrd(v); else ddata()=v;}
Note: See TracChangeset
for help on using the changeset viewer.