本文整理汇总了C++中ofAbstractParameter::getEscapedName方法的典型用法代码示例。如果您正苦于以下问题:C++ ofAbstractParameter::getEscapedName方法的具体用法?C++ ofAbstractParameter::getEscapedName怎么用?C++ ofAbstractParameter::getEscapedName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofAbstractParameter
的用法示例。
在下文中一共展示了ofAbstractParameter::getEscapedName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserialize
void ofXml::deserialize(ofAbstractParameter & parameter){
if(!parameter.isSerializable()) return;
string name = parameter.getEscapedName();
if(parameter.type()==typeid(ofParameterGroup).name()){
ofParameterGroup & group = static_cast<ofParameterGroup&>(parameter);
if(setTo(name)){
for(int i=0;i<group.size();i++){
deserialize(group.get(i));
}
setToParent();
}
}else{
if(exists(name)){
if(parameter.type()==typeid(ofParameter<int>).name()){
parameter.cast<int>() = getIntValue(name);
}else if(parameter.type()==typeid(ofParameter<float>).name()){
parameter.cast<float>() = getFloatValue(name);
}else if(parameter.type()==typeid(ofParameter<bool>).name()){
parameter.cast<bool>() = getBoolValue(name);
}else if(parameter.type()==typeid(ofParameter<int64_t>).name()){
parameter.cast<int64_t>() = getInt64Value(name);
}else if(parameter.type()==typeid(ofParameter<string>).name()){
parameter.cast<string>() = getValue(name);
}else{
parameter.fromString(getValue(name));
}
}
}
}
示例2: deserialize
void ofxXmlSettings::deserialize(ofAbstractParameter & parameter){
if(!parameter.isSerializable()) return;
string name = parameter.getEscapedName();
if(parameter.type()==typeid(ofParameterGroup).name()){
ofParameterGroup & group = static_cast<ofParameterGroup&>(parameter);
if(tagExists(name)){
pushTag(name);
for(int i=0;i<group.size();i++){
deserialize(group.get(i));
}
popTag();
}
}else{
if(tagExists(name)){
if(parameter.type()==typeid(ofParameter<int>).name()){
parameter.cast<int>() = getValue(name,0);
}else if(parameter.type()==typeid(ofParameter<float>).name()){
parameter.cast<float>() = getValue(name,0.0f);
}else if(parameter.type()==typeid(ofParameter<bool>).name()){
parameter.cast<bool>() = getValue(name,false);
}else if(parameter.type()==typeid(ofParameter<string>).name()){
parameter.cast<string>() = getValue(name,"");
}else{
parameter.fromString(getValue(name,""));
}
}
}
}
示例3: serialize
void ofXml::serialize(const ofAbstractParameter & parameter){
if(!parameter.isSerializable()) return;
string name = parameter.getEscapedName();
if(name=="") name="UnknownName";
if(parameter.type()==typeid(ofParameterGroup).name()){
const ofParameterGroup & group = static_cast<const ofParameterGroup&>(parameter);
if(!exists(name)){
addChild(name);
ofLogVerbose("ofXml") << "creating group " << name;
}
setTo(name);
ofLogVerbose("ofXml") << "group " << name;
for(int i=0;i<group.size();i++){
serialize(group.get(i));
}
ofLogVerbose("ofXml") << "end group " << name;
setToParent();
}else{
string value = parameter.toString();
if(!exists(name)){
addChild(name);
ofLogVerbose("ofXml") << "creating tag " << name;
}
ofLogVerbose("ofXml") << "setting tag " << name << ": " << value;
setValue(name,value);
}
}
示例4: ofDeserialize
void ofDeserialize(const ofXml & xml, ofAbstractParameter & parameter){
if(!parameter.isSerializable()){
return;
}
string name = parameter.getEscapedName();
ofXml child = xml.findFirst(name);
if(child){
if(parameter.type() == typeid(ofParameterGroup).name()){
ofParameterGroup & group = static_cast <ofParameterGroup &>(parameter);
for(auto & p: group){
ofDeserialize(child, *p);
}
}else{
if(parameter.type() == typeid(ofParameter <int> ).name()){
parameter.cast <int>() = child.getIntValue();
}else if(parameter.type() == typeid(ofParameter <float> ).name()){
parameter.cast <float>() = child.getFloatValue();
}else if(parameter.type() == typeid(ofParameter <bool> ).name()){
parameter.cast <bool>() = child.getBoolValue();
}else if(parameter.type() == typeid(ofParameter <string> ).name()){
parameter.cast <string>() = child.getValue();
}else{
parameter.fromString(child.getValue());
}
}
}
}
示例5: ofSerialize
void ofSerialize(ofXml & xml, const ofAbstractParameter & parameter){
if(!parameter.isSerializable()){
return;
}
string name = parameter.getEscapedName();
if(name == ""){
name = "UnknownName";
}
ofXml child = xml.findFirst(name);
if(!child){
child = xml.appendChild(name);
ofLogVerbose("ofXml") << "creating group " << name;
}
if(parameter.type() == typeid(ofParameterGroup).name()){
const ofParameterGroup & group = static_cast <const ofParameterGroup &>(parameter);
ofLogVerbose("ofXml") << "group " << name;
for(auto & p: group){
ofSerialize(child, *p);
}
ofLogVerbose("ofXml") << "end group " << name;
}else{
string value = parameter.toString();
child.set(value);
}
}
示例6: getParameterName
string OscController::getParameterName(ofAbstractParameter ¶meter){
string paramName = "";
const vector<string> hierarchy = parameter.getGroupHierarchyNames();
for(int i=0; i<(int)hierarchy.size()-1; i++){
paramName += hierarchy[i] + ".";
}
paramName += parameter.getEscapedName();
return paramName;
}
示例7: appendParameter
void ofxOscSender::appendParameter( ofxOscMessage & msg, const ofAbstractParameter & parameter, string address){
msg.setAddress(address+parameter.getEscapedName());
if(parameter.type()==typeid(ofParameter<int>).name()){
msg.addIntArg(parameter.cast<int>());
}else if(parameter.type()==typeid(ofParameter<float>).name()){
msg.addFloatArg(parameter.cast<float>());
}else if(parameter.type()==typeid(ofParameter<bool>).name()){
msg.addIntArg(parameter.cast<bool>());
}else{
msg.addStringArg(parameter.toString());
}
}
示例8: serialize
void ofxXmlSettings::serialize(const ofAbstractParameter & parameter){
if(!parameter.isSerializable()) return;
string name = parameter.getEscapedName();
if(name=="") name="UnknownName";
if(parameter.type()==typeid(ofParameterGroup).name()){
const ofParameterGroup & group = static_cast<const ofParameterGroup&>(parameter);
if(!tagExists(name)) addTag(name);
pushTag(name);
for(int i=0;i<group.size();i++){
serialize(group.get(i));
}
popTag();
}else{
string value = parameter.toString();
if(!tagExists(name))
addValue(name,value);
else
setValue(name,value);
}
}
示例9: add
void ofParameterGroup::add(ofAbstractParameter & param) {
obj->parameters.push_back(¶m);
obj->parametersIndex[param.getEscapedName()] = obj->parameters.size()-1;
param.setParent(this);
}