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


C++ defaultValue函数代码示例

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


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

示例1: JSON_ASSERT

Value &
Value::operator[]( ArrayIndex index )
{
   JSON_ASSERT( type_ == nullValue  ||  type_ == arrayValue );
   if ( type_ == nullValue )
      *this = Value( arrayValue );
#ifndef JSON_VALUE_USE_INTERNAL_MAP
   CZString key( index );
   ObjectValues::iterator it = value_.map_->lower_bound( key );
   if ( it != value_.map_->end()  &&  (*it).first == key )
      return (*it).second;

   ObjectValues::value_type defaultValue( key, null );
   it = value_.map_->insert( it, defaultValue );
   return (*it).second;
#else
   return value_.array_->resolveReference( index );
#endif
}
开发者ID:JongKul,项目名称:Infinity,代码行数:19,代码来源:json_value.cpp

示例2: defaultValue

  std::vector<openstudio::path> WorkflowJSON_Impl::filePaths() const
  {
    std::vector<openstudio::path> result;

    Json::Value defaultValue(Json::arrayValue);

    Json::Value paths = m_value.get("file_paths", defaultValue);
    paths.append("./files");
    paths.append("./weather");
    paths.append("../../files");
    paths.append("../../weather");
    paths.append("./");

    Json::ArrayIndex n = paths.size();
    for (Json::ArrayIndex i = 0; i < n; ++i){
      result.push_back(toPath(paths[i].asString()));
    }

    return result;
  }
开发者ID:NREL,项目名称:OpenStudio,代码行数:20,代码来源:WorkflowJSON.cpp

示例3: write

void UmlRelation::gen_uml_decl()
{
    if (isClassMember())
        fw.write("static, ");

    write(visibility());
    writeq(roleName());
    fw.write(" : ");
    roleType()->write();

    QByteArray s;

    s = defaultValue();

    if (!s.isEmpty()) {
        if (s[0] != '=')
            fw.write(" = ");

        writeq(s);
    }

    s = multiplicity();

    if (!s.isEmpty()) {
        fw.write(", multiplicity : ");
        writeq(s);
    }

    if (isDerived())
        fw.write((isDerivedUnion()) ? ", derived union" : ", derived");

    if (isReadOnly())
        fw.write(", read only");

    if (isOrdered())
        fw.write(", ordered");

    if (isUnique())
        fw.write(", unique");

}
开发者ID:javrillon,项目名称:douml,代码行数:41,代码来源:UmlRelation.cpp

示例4: define

void UmlActivityParameter::html(Q3CString pfix, unsigned int rank, unsigned int level) {
  define();

  fw.write("<table><tr><td><div class=\"element\">Activity action pin <b>");
  writeq(name());
  fw.write("</b></div></td></tr></table>\n");

  Q3CString s = defaultValue();
  
  if (! s.isEmpty()) {
    fw.write("<p>Default value :</p><ul>");
  
    fw.write("<pre>\n");
    writeq(s);
    fw.write("</pre></ul>");
  }

  UmlPinParameter::html(pfix, rank, level);

  unload(FALSE, FALSE);
}
开发者ID:SciBoy,项目名称:douml,代码行数:21,代码来源:UmlActivityParameter.cpp

示例5: typeString

QString Field::diff( Field * after )
{
	QStringList ret;
	if( type() != after->type() )
		ret += "Type Changed from " + typeString() + " to " + after->typeString();
	for( int i=0; i<Field::LastFlag; i++ ) {
		Flags f((Field::Flags)i);
		if( flag(f) != after->flag(f) )
			ret += QString(flag(f) ? "-" : "+") + " " + stringFromFlag(i);
	}
	if( pluralMethodName() != after->pluralMethodName() )
		ret += "Plural Method Name changed from " + pluralMethodName() + " to " + after->pluralMethodName();
	if( methodName() != after->methodName() )
		ret += "Method Name changed from " + methodName() + " to " + after->methodName();
	if( displayName() != after->displayName() )
		ret += "Display Name changed from " + displayName() + " to " + after->displayName();
	if( defaultValue() != after->defaultValue() )
		ret += "Default Value changed from " + defaultValueString() + " to " + after->defaultValueString();
	if( (bool(foreignKeyTable()) != bool(after->foreignKeyTable())) || (foreignKeyTable() && foreignKeyTable()->tableName().toLower() != after->foreignKeyTable()->tableName().toLower()) )
		ret += "Foreign Key Table changed from " + (foreignKeyTable() ? foreignKeyTable()->tableName() : "") + " to " + (after->foreignKeyTable() ? after->foreignKeyTable()->tableName() : "");
	return ret.isEmpty() ? QString() : ("\t" + table()->tableName() + "." + name() + " Changes:\n\t\t" + ret.join("\n\t\t"));
}
开发者ID:EntityFXCode,项目名称:arsenalsuite,代码行数:22,代码来源:field.cpp

示例6: readConfFile

static BOOLEAN readConfFile(void){

    //load default value
    defaultValue();

    // if file does not exist
    if( !access(filePath[0],F_OK)==0)  {
        return FALSE ;
    }

    // file exist
    FILE* fp =fopen(filePath[0],"r");
    if( fp == NULL ){
        printf("Can not open file %s", filePath[0]);
        //LogWrite(ERROR,"Open %s Fail! %s",strerror(errno));
        return FALSE ;
    }

    // read data
    char line[100]={0}; 
    while(fgets(line, sizeof(line), fp)!= NULL){
        if( isSkipRow(line) )
            continue; 

        char* pos = strchr(line, '=');
        if( pos == NULL ) continue;

        char* key = line;
        char* value = pos+1;
        *pos = '\0';
        value[strlen(value)-1] = '\0';    // remove '\n'

        setVariable(key,value);
        memset(line, 0, 100);
    }
    fclose(fp);
    return TRUE;
    //LogWrite(INFO,"Read %s file finished!",filePath[0]);
}
开发者ID:yjshen,项目名称:collector-adapter,代码行数:39,代码来源:conf.c

示例7: JSON_ASSERT

Value &
Value::resolveReference( const char *key, 
                         bool isStatic )
{
   JSON_ASSERT( type_ == nullValue  ||  type_ == objectValue );
   if ( type_ == nullValue )
      *this = Value( objectValue );
#ifndef JSON_VALUE_USE_INTERNAL_MAP
   CZString actualKey( key, isStatic ? CZString::noDuplication 
                                     : CZString::duplicateOnCopy );
   ObjectValues::iterator it = value_.map_->lower_bound( actualKey );
   if ( it != value_.map_->end()  &&  (*it).first == actualKey )
      return (*it).second;

   ObjectValues::value_type defaultValue( actualKey, null );
   it = value_.map_->insert( it, defaultValue );
   Value &value = (*it).second;
   return value;
#else
   return value_.map_->resolveReference( key, isStatic );
#endif
}
开发者ID:jjiezheng,项目名称:game-platform-core-native,代码行数:22,代码来源:json_value.cpp

示例8: set

void COptionBool::load() { set(m_parent->getSectionValue(section(), key(), defaultValue()).toBool()); }
开发者ID:Sheridan,项目名称:gpstool,代码行数:1,代码来源:coptionbool.cpp

示例9: switch


//.........这里部分代码省略.........
                else if (!strncmp(p, "${description}", 14))
                    manage_description(p, pp);
                else if (!strncmp(p, "${visibility}", 13)) {
                    p += 13;
                    generate_visibility(f, cl_stereotype);
                }
                else if (!strncmp(p, "${static}", 9)) {
                    p += 9;
                    if (isClassMember())
                        f << "static ";
                }
                else if (!strncmp(p, "${final}", 8)) {
                    p += 8;
                    if (isReadOnly())
                        f << "final ";
                }
                else if (!strncmp(p, "${transient}", 12)) {
                    p += 12;
                    if (isJavaTransient())
                        f << "transient ";
                }
                else if (!strncmp(p, "${volatile}", 11)) {
                    p += 11;
                    if (isVolatile())
                        f << "volatile ";
                }
                else if (!strncmp(p, "${type}", 7)) {
                    p += 7;
                    roleType()->write(f);
                }
                else if (!strncmp(p, "${stereotype}", 13)) {
                    p += 13;
                    f << JavaSettings::relationAttributeStereotype(stereotype());
                }
                else if (!strncmp(p, "${name}", 7)) {
                    p += 7;
                    f << roleName();
                }
                else if (!strncmp(p, "${inverse_name}", 15)) {
                    p += 15;
                    switch (relationKind()) {
                    case anAssociation:
                    case anAggregation:
                    case anAggregationByValue:
                        f << side(side(TRUE) != this)->roleName();
                    default:
                        break;
                    }
                }
                else if (!strncmp(p, "${multiplicity}", 15)) {
                    p += 15;

                    Q3CString m = multiplicity();

                    if (*m != '[')
                        f << "[]";
                    else {
                        for (unsigned index = 0; index != m.length(); index += 1) {
                            switch (m.at(index)) {
                            case '[':
                                f << '[';
                                break;
                            case ']':
                                f << ']';
                            default:
                                break;
                            }
                        }
                    }
                }
                else if (!strncmp(p, "${value}", 8)) {
                    if (!defaultValue().isEmpty()) {
                        if (need_equal(p, defaultValue()))
                            f << " = ";
                        f << defaultValue();
                    }
                    p += 8;
                }
                else if (!strncmp(p, "${association}", 14)) {
                    p += 14;
                    UmlClass::write(f, association());
                }
                else if (!strncmp(p, "${@}", 4)) {
                    p += 4;
                    if (pp != 0)
                        f << "${@}";
                    else if (! javaAnnotations().isEmpty()) {
                        pp =p;
                        p = javaAnnotations();
                    }
                }
                else
                    // strange
                    f << *p++;
            }

            f << '\n';
        }
    }
}
开发者ID:SciBoy,项目名称:douml,代码行数:101,代码来源:UmlRelation.cpp

示例10: defaultValue

QVariant Settings::value(const QString &key) const
{
    return mSettings.value(key, defaultValue(key));
}
开发者ID:DoubleYouEl,项目名称:CrochetCharts,代码行数:4,代码来源:settings.cpp

示例11: phpDecl

void UmlAttribute::generate(QTextStream & f, const WrapperStr & st,
                            WrapperStr indent, int & enum_item_rank)
{
    if (!phpDecl().isEmpty()) {
        const char * p = phpDecl();
        const char * pp = 0;

        while ((*p == ' ') || (*p == '\t'))
            indent += *p++;

        f << indent;

        for (;;) {
            if (*p == 0) {
                if (pp == 0)
                    break;

                // comment management done
                p = pp;
                pp = 0;

                if (*p == 0)
                    break;

                f << indent;
            }

            if (*p == '\n') {
                f << *p++;

                if (*p)
                    f << indent;
            }
            else if (*p == '@')
                manage_alias(p, f);
            else if (*p != '$')
                f << *p++;
            else if (!strncmp(p, "${comment}", 10))
                manage_comment(p, pp, PhpSettings::isGenerateJavadocStyleComment());
            else if (!strncmp(p, "${description}", 14))
                manage_description(p, pp);
            else if (!strncmp(p, "${visibility}", 13)) {
                p += 13;
                generate_visibility(f);
            }
            else if (!strncmp(p, "${static}", 9)) {
                p += 9;

                if (isClassMember())
                    f << "static ";
            }
            else if (!strncmp(p, "${type}", 7)) {
                p += 7;
                UmlClass::write(f, type());
            }
            else if (!strncmp(p, "${name}", 7)) {
                p += 7;

                if ((st != "enum") && !isReadOnly())
                    f << "$";

                f << name();
            }
            else if (!strncmp(p, "${var}", 6)) {
                p += 6;

                if ((st != "enum") &&
                    !isReadOnly() &&
                    !isClassMember() &&
                    (visibility() == PackageVisibility))
                    f << "var ";
            }
            else if (!strncmp(p, "${value}", 8)) {
                if (!defaultValue().isEmpty()) {
                    if (need_equal(p, defaultValue()))
                        f << " = ";

                    f << defaultValue();
                }
                else if (st == "enum")
                    f << " = " << enum_item_rank;

                p += 8;
            }
            else if (!strncmp(p, "${const}", 8)) {
                p += 8;

                if (isReadOnly())
                    f << "const ";
            }
            else
                f << *p++;
        }

        f << '\n';
    }

    enum_item_rank += 1;
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:99,代码来源:UmlAttribute.cpp

示例12: setValue

void HTMLTextAreaElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
    setValue(defaultValue());
    HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:5,代码来源:HTMLTextAreaElement.cpp

示例13: defaultValue

bool JSObject::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result)
{
    result = defaultValue(exec, PreferNumber);
    number = result.toNumber(exec);
    return !result.isString();
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:6,代码来源:JSObject.cpp

示例14: switch


//.........这里部分代码省略.........
                }

                if (*p == '\n') {
                    f_h << toLocale(p);

                    if (*p && (*p != '#'))
                        f_h << indent;
                }
                else if (*p == '@')
                    manage_alias(p, f_h);
                else if (*p != '$')
                    f_h << toLocale(p);
                else if (!strncmp(p, "${comment}", 10))
                    manage_comment(p, pp, CppSettings::isGenerateJavadocStyleComment());
                else if (!strncmp(p, "${description}", 14))
                    manage_description(p, pp);
                else if (!strncmp(p, "${static}", 9)) {
                    p += 9;

                    if (isClassMember())
                        f_h << "static ";
                }
                else if (!strncmp(p, "${const}", 8)) {
                    p += 8;

                    if (isReadOnly())
                        f_h << "const ";
                }
                else if (!strncmp(p, "${volatile}", 11)) {
                    p += 11;

                    if (isVolatile())
                        f_h << "volatile ";
                }
                else if (!strncmp(p, "${mutable}", 10)) {
                    p += 10;

                    if (isCppMutable())
                        f_h << "mutable ";
                }
                else if (!strncmp(p, "${type}", 7)) {
                    p += 7;
                    roleType()->write(f_h);
                }
                else if (!strncmp(p, "${name}", 7)) {
                    p += 7;
                    f_h << roleName();
                }
                else if (!strncmp(p, "${inverse_name}", 15)) {
                    p += 15;

                    switch (relationKind()) {
                    case anAssociation:
                    case anAggregation:
                    case anAggregationByValue:
                        f_h << side(side(TRUE) != this)->roleName();

                    default:
                        break;
                    }
                }
                else if (!strncmp(p, "${multiplicity}", 15)) {
                    p += 15;

                    const WrapperStr & m = multiplicity();

                    if (!m.isEmpty() && (*((const char *) m) == '['))
                        f_h << m;
                    else
                        f_h << '[' << m << ']';
                }
                else if (!strncmp(p, "${stereotype}", 13)) {
                    p += 13;
                    f_h << CppSettings::relationAttributeStereotype(stereotype());
                }
                else if (!strncmp(p, "${value}", 8))
                    p += 8;
                else if (!strncmp(p, "${h_value}", 10)) {
                    if (!defaultValue().isEmpty() && isClassMember()) {
                        if (need_equal(p, defaultValue()))
                            f_h << " = ";

                        f_h << defaultValue();
                    }

                    p += 10;
                }
                else if (!strncmp(p, "${association}", 14)) {
                    p += 14;
                    UmlClass::write(f_h, association());
                }
                else
                    // strange
                    f_h << toLocale(p);
            }

            f_h << '\n';
        }
    }
}
开发者ID:harmegnies,项目名称:douml,代码行数:101,代码来源:UmlRelation.cpp

示例15: setLanguage

void Settings::readSettings()
{
    setLanguage(value(KEY_LANGUAGE, defaultValue(KEY_LANGUAGE)).toString());

    setPlaylist(value(KEY_PLAYLIST, defaultValue(KEY_PLAYLIST)).toString());
    setPlaylistUpdate(value(KEY_PLAYLIST_UPDATE, defaultValue(KEY_PLAYLIST_UPDATE)).toBool());
    setPlaylistUpdateUrl(value(KEY_PLAYLIST_UPDATE_URL, defaultValue(KEY_PLAYLIST_UPDATE_URL)).toString());
    setRadioCategory(value(KEY_RADIO_CATEGORY, defaultValue(KEY_RADIO_CATEGORY)).toString());
    setHdCategory(value(KEY_HD_CATEGORY, defaultValue(KEY_HD_CATEGORY)).toString());
    setUdpxy(value(KEY_UDPXY, defaultValue(KEY_UDPXY)).toBool());
    setUdpxyUrl(value(KEY_UDPXY_URL, defaultValue(KEY_UDPXY_URL)).toString());
    setUdpxyPort(value(KEY_UDPXY_PORT, defaultValue(KEY_UDPXY_PORT)).toInt());

    setWidth(value(KEY_WIDTH, defaultValue(KEY_WIDTH)).toInt());
    setHeight(value(KEY_HEIGHT, defaultValue(KEY_HEIGHT)).toInt());
    setPosX(value(KEY_POS_X, defaultValue(KEY_POS_X)).toInt());
    setPosY(value(KEY_POS_Y, defaultValue(KEY_POS_Y)).toInt());

    setOsd(value(KEY_OSD, defaultValue(KEY_OSD)).toBool());
    setTrayEnabled(value(KEY_TRAY_ENABLED, defaultValue(KEY_TRAY_ENABLED)).toBool());
    setHideToTray(value(KEY_HIDE_TO_TRAY, defaultValue(KEY_HIDE_TO_TRAY)).toBool());
    setMouseWheel(value(KEY_MOUSE_WHEEL, defaultValue(KEY_MOUSE_WHEEL)).toString());
    setRememberGuiSession(value(KEY_REMEMBER_GUI_SESSION, defaultValue(KEY_REMEMBER_GUI_SESSION)).toBool());
    setIcons(value(KEY_ICONS, defaultValue(KEY_ICONS)).toString());

    setVout(value(KEY_VOUT, defaultValue(KEY_VOUT)).toInt());
    setAout(value(KEY_AOUT, defaultValue(KEY_AOUT)).toInt());
    setYuvToRgb(value(KEY_YUV_TO_RGB, defaultValue(KEY_MUTE_ON_MINIMIZE)).toBool());
    setSpdif(value(KEY_SPDIF, defaultValue(KEY_SPDIF)).toBool());

    setRememberVideoSettings(value(KEY_REMEMBER_VIDEO_SETTINGS, defaultValue(KEY_REMEMBER_VIDEO_SETTINGS)).toBool());
    setRememberVideoPerChannel(value(KEY_REMEMBER_VIDEO_PER_CHANNEL, defaultValue(KEY_REMEMBER_VIDEO_PER_CHANNEL)).toBool());
    setAspectRatio(value(KEY_ASPECT_RATIO, defaultValue(KEY_ASPECT_RATIO)).toInt());
    setCropRatio(value(KEY_CROP_RATIO, defaultValue(KEY_CROP_RATIO)).toInt());
    setDeinterlacing(value(KEY_DEINTERLACING, defaultValue(KEY_DEINTERLACING)).toInt());
    setAudioLanguage(value(KEY_AUDIO_LANGUAGE, defaultValue(KEY_AUDIO_LANGUAGE)).toString());
    setSubtitleLanguage(value(KEY_SUBTITLE_LANGUAGE, defaultValue(KEY_SUBTITLE_LANGUAGE)).toString());

    setMuteOnMinimize(value(KEY_MUTE_ON_MINIMIZE, defaultValue(KEY_MUTE_ON_MINIMIZE)).toBool());
    setTeletext(value(KEY_TELETEXT, defaultValue(KEY_TELETEXT)).toBool());

    setRecorderDirectory(value(KEY_RECORDER_DIRECTORY, defaultValue(KEY_RECORDER_DIRECTORY)).toString());
    setSnapshotsDirectory(value(KEY_SNAPSHOTS_DIRECTORY, defaultValue(KEY_SNAPSHOTS_DIRECTORY)).toString());

    setSessionAutoplay(value(KEY_SESSION_AUTOPLAY, defaultValue(KEY_SESSION_AUTOPLAY)).toBool());
    setSessionChannel(value(KEY_SESSION_CHANNEL, defaultValue(KEY_SESSION_CHANNEL)).toInt());
    setSessionRememberVolume(value(KEY_SESSION_REMEMBER_VOLUME, defaultValue(KEY_SESSION_REMEMBER_VOLUME)).toBool());
    setSessionVolume(value(KEY_SESSION_VOLUME, defaultValue(KEY_SESSION_VOLUME)).toInt());

    setXmltvUpdate(value(KEY_XMLTV_UPDATE, defaultValue(KEY_XMLTV_UPDATE)).toBool());
    setXmltvUpdateLocation(value(KEY_XMLTV_UPDATE_LOCATION, defaultValue(KEY_XMLTV_UPDATE_LOCATION)).toString());
    setXmltvUpdateRemote(value(KEY_XMLTV_UPDATE_REMOTE, defaultValue(KEY_XMLTV_UPDATE_REMOTE)).toBool());
}
开发者ID:sun-friderick,项目名称:tano,代码行数:53,代码来源:Settings.cpp


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