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 }
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; }
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"); }
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); }
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")); }
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]); }
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 }
void COptionBool::load() { set(m_parent->getSectionValue(section(), key(), defaultValue()).toBool()); }
void UmlRelation::generate(QTextOStream & f, const Q3CString & cl_stereotype, Q3CString indent) { switch (relationKind()) { case aDependency: case aGeneralisation: case aRealization: break; default: if (!javaDecl().isEmpty()) { if (cl_stereotype == "enum_pattern") { write_trace_header(); UmlCom::trace(" <font color=\"red\"><b>an <i>enum_pattern</i> cannot have relation</b></font><br>"); incr_warning(); return; } const char * p = javaDecl(); const char * pp = 0; Q3CString s; 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, JavaSettings::isGenerateJavadocStyleComment()); 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'; } } }
QVariant Settings::value(const QString &key) const { return mSettings.value(key, defaultValue(key)); }
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; }
void HTMLTextAreaElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { setValue(defaultValue()); HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); }
bool JSObject::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) { result = defaultValue(exec, PreferNumber); number = result.toNumber(exec); return !result.isString(); }
void UmlRelation::generate_decl(aVisibility & current_visibility, QTextStream & f_h, const WrapperStr & cl_stereotype, WrapperStr indent, BooL & first, bool) { switch (relationKind()) { case aDependency: if (stereotype() == "friend") { Q3ValueList<UmlFormalParameter> formals = roleType()->formals(); if (! formals.isEmpty()) { const char * sep = " template <"; Q3ValueList<UmlFormalParameter>::ConstIterator it; for (it = formals.begin(); it != formals.end(); ++it) { f_h << sep << (*it).type() << ' ' << (*it).name(); sep = ", "; } f_h << "> "; } else f_h << " "; f_h << "friend " << roleType()->cpp_stereotype() << " "; roleType()->write(f_h, FALSE); f_h << ";\n"; first = FALSE; } break; case aGeneralisation: case aRealization: break; default: if (!cppDecl().isEmpty()) { if (cl_stereotype == "enum") { write_trace_header(); UmlCom::trace(" <font color=\"red\"><b>an <i>enum</i> cannot have relation</b></font><br>"); incr_warning(); return; } if (cl_stereotype == "typedef") { write_trace_header(); UmlCom::trace(" <font color=\"red\"><b>a <i>typedef</i> cannot have relation</b></font><br>"); incr_warning(); return; } generate_visibility(current_visibility, f_h, first, indent); first = FALSE; const char * p = cppDecl(); const char * pp = 0; WrapperStr s; while ((*p == ' ') || (*p == '\t')) indent += toLocale(p); if (*p != '#') f_h << indent; for (;;) { if (*p == 0) { if (pp == 0) break; // comment management done p = pp; pp = 0; if (*p == 0) break; if (*p != '#') f_h << indent; } 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'; } } }
void UmlRelation::generate(QTextStream & f, const Q3CString &, Q3CString indent, int &) { switch (relationKind()) { case aDependency: case aGeneralisation: case aRealization: break; default: if (!phpDecl().isEmpty()) { const char * p = phpDecl(); const char * pp = 0; Q3CString s; 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; roleType()->write(f); } else if (!strncmp(p, "${name}", 7)) { p += 7; if (!isReadOnly()) f << "$"; f << roleName(); } else if (!strncmp(p, "${inverse_name}", 15)) { p += 15; switch (relationKind()) { case anAssociation: case anAggregation: case anAggregationByValue: { UmlRelation * inverse = side(side(TRUE) != this); if (!inverse->isReadOnly()) f << "$"; f << inverse->roleName(); } default: break; } } else if (!strncmp(p, "${var}", 6)) { p += 6; if (!isReadOnly() && !isClassMember() && (visibility() == PackageVisibility)) f << "var "; } else if (!strncmp(p, "${value}", 8)) { if (!defaultValue().isEmpty()) { if (need_equal(p, defaultValue())) f << " = "; f << defaultValue(); } p += 8; } else if (!strncmp(p, "${const}", 8)) { p += 8; if (isReadOnly()) f << "const "; } else f << *p++; } f << '\n'; } } }
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()); }
void UmlAttribute::generate_decl(aVisibility & current_visibility, QTextOStream & f_h, const Q3CString & cl_stereotype, Q3CString indent, BooL & first, bool last) { if (cl_stereotype == "typedef") { write_trace_header(); UmlCom::trace(" <font color=\"red\"><b>a <i>typedef</i> cannot have attribute</b></font><br>"); incr_warning(); return; } const char * p = cppDecl(); const char * pp = 0; bool in_enum = (cl_stereotype == "enum"); if (!in_enum) generate_visibility(current_visibility, f_h, first, indent); first = FALSE; while ((*p == ' ') || (*p == '\t')) indent += *p++; if (*p != '#') f_h << indent; for (;;) { if (*p == 0) { if (pp == 0) break; // comment management done p = pp; pp = 0; if (*p == 0) break; if (*p != '#') f_h << indent; } if (*p == '\n') { f_h << *p++; if (*p && (*p != '#')) f_h << indent; } else if (*p == '@') manage_alias(p, f_h); else if (*p != '$') f_h << *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, "${name}", 7)) { p += 7; f_h << name(); } else if (!strncmp(p, "${multiplicity}", 15)) { p += 15; const Q3CString & 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) || !strncmp(p, "${h_value}", 10)) { const char * pb = p; p += (p[2] == 'h') ? 10 : 8; if (in_enum) { if (!defaultValue().isEmpty()) { if (need_equal(pb, defaultValue())) f_h << " = "; f_h << defaultValue(); } if (last) { if (*p == ',') p += 1; } else if (*p != ',') f_h << ','; } else if ((p[-8] == 'h') && isClassMember() && !defaultValue().isEmpty()) { if (need_equal(pb, defaultValue())) f_h << " = "; f_h << defaultValue(); } } else if (in_enum) // strange f_h << *p++; 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; UmlClass::write(f_h, type()); //f_h << CppSettings::Type(Type().Type()); } else // strange f_h << *p++; } f_h << '\n'; }
void UmlAttribute::generate_def(QTextOStream & f, Q3CString indent, bool h, Q3CString templates, Q3CString cl_names, Q3CString, Q3CString) { if (isClassMember() && !cppDecl().isEmpty()) { UmlClass * cl = (UmlClass *) parent(); if ((!templates.isEmpty() || ((cl->name().find('<') != -1))) ? h : !h) { const char * p = cppDecl(); const char * pp = 0; while ((*p == ' ') || (*p == '\t')) p += 1; bool re_template = !templates.isEmpty() && insert_template(p, f, indent, templates); if (*p != '#') f << indent; const char * pname = name_spec(p); for (;;) { if (*p == 0) { if (pp == 0) break; // comment management done p = pp; pp = 0; if (re_template) f << templates; if (*p == 0) break; f << indent; } if (*p == '\n') { f << *p++; if (*p && (*p != '#')) f << indent; } else if (*p == '@') manage_alias(p, f); else if (*p != '$') { if (p == pname) f << cl_names << "::"; f << *p++; } else if (!strncmp(p, "${comment}", 10)) { if (!manage_comment(p, pp, CppSettings::isGenerateJavadocStyleComment()) && re_template) f << templates; } else if (!strncmp(p, "${description}", 14)) { if (!manage_description(p, pp) && re_template) f << templates; } else if (!strncmp(p, "${name}", 7)) { if (*pname == '$') f << cl_names << "::"; p += 7; f << name(); } else if (!strncmp(p, "${multiplicity}", 15)) { p += 15; const Q3CString & m = multiplicity(); if (!m.isEmpty() && (*((const char *) m) == '[')) f << m; else f << '[' << m << ']'; } else if (!strncmp(p, "${stereotype}", 13)) { p += 13; f << CppSettings::relationAttributeStereotype(stereotype()); } else if (!strncmp(p, "${value}", 8)) { if (!defaultValue().isEmpty()) { if (need_equal(p, defaultValue())) f << " = "; f << defaultValue(); } p += 8; } else if (!strncmp(p, "${h_value}", 10)) p += 10; else if (!strncmp(p, "${static}", 9)) { p += 9; } else if (!strncmp(p, "${const}", 8)) { p += 8; if (isReadOnly()) f << "const "; } else if (!strncmp(p, "${volatile}", 11)) { p += 11; if (isVolatile()) f << "volatile "; } else if (!strncmp(p, "${mutable}", 10)) { p += 10; } else if (!strncmp(p, "${type}", 7)) { p += 7; UmlClass::write(f, type()); //f << CppSettings::Type(Type().Type()); } else // strange f << *p++; } f << '\n'; } } }
void CJX_Field::rawValue(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute) { defaultValue(pValue, bSetting, eAttribute); }
void UmlRelation::generate_def(QTextStream & f, WrapperStr indent, bool h, WrapperStr templates, WrapperStr cl_names, WrapperStr, WrapperStr) { if (isClassMember() && !cppDecl().isEmpty()) { UmlClass * cl = (UmlClass *) parent(); if ((!templates.isEmpty() || (cl->name().find('<') != -1)) ? h : !h) { const char * p = cppDecl(); const char * pp = 0; while ((*p == ' ') || (*p == '\t')) p += 1; bool re_template = !templates.isEmpty() && insert_template(p, f, indent, templates); if (*p != '#') f << indent; const char * pname = name_spec(p); for (;;) { if (*p == 0) { if (pp == 0) break; // comment management done p = pp; pp = 0; if (re_template) f << templates; if (*p == 0) break; if (*p != '#') f << indent; } if (*p == '\n') { f << toLocale(p); if (*p && (*p != '#')) f << indent; } else if (*p == '@') manage_alias(p, f); else if (*p != '$') { if (p == pname) f << cl_names << "::"; f << toLocale(p); } else if (!strncmp(p, "${comment}", 10)) { if (!manage_comment(p, pp, CppSettings::isGenerateJavadocStyleComment()) && re_template) f << templates; } else if (!strncmp(p, "${description}", 14)) { if (!manage_description(p, pp) && re_template) f << templates; } else if (!strncmp(p, "${static}", 9)) { p += 9; } else if (!strncmp(p, "${const}", 8)) { p += 8; if (isReadOnly()) f << "const "; } else if (!strncmp(p, "${volatile}", 11)) { p += 11; if (isVolatile()) f << "volatile "; } else if (!strncmp(p, "${mutable}", 10)) { p += 10; } else if (!strncmp(p, "${type}", 7)) { p += 7; roleType()->write(f); } else if (!strncmp(p, "${name}", 7)) { p += 7; if (*pname == '$') f << cl_names << "::"; 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; const WrapperStr & m = multiplicity(); if (!m.isEmpty() && (*((const char *) m) == '[')) f << m; else f << '[' << m << ']'; } else if (!strncmp(p, "${stereotype}", 13)) { p += 13; f << CppSettings::relationAttributeStereotype(stereotype()); } else if (!strncmp(p, "${value}", 8)) { if (!defaultValue().isEmpty()) { if (need_equal(p, defaultValue())) f << " = "; f << defaultValue(); } p += 8; } else if (!strncmp(p, "${h_value}", 10)) p += 10; else if (!strncmp(p, "${association}", 14)) { p += 14; UmlClass::write(f, association()); } else // strange f << toLocale(p); } f << '\n'; } } }
void UmlRelation::write_relation_as_attribute(FileOut & out) { UmlRelation * first = side(TRUE); Q3CString s; UmlClass * base; if ((first->parent()->stereotype() == "stereotype") && (first->roleType()->stereotype() == "metaclass")) { if (this != first) return; base = first->roleType(); s = "base_" + base->name(); } else { base = 0; switch (_lang) { case Uml: s = roleName(); break; case Cpp: if (cppDecl().isEmpty()) return; s = true_name(roleName(), cppDecl()); break; default: // Java if (javaDecl().isEmpty()) return; s = true_name(roleName(), javaDecl()); } } out.indent(); out << "<ownedAttribute xmi:type=\"uml:Property\" name=\"" << s << '"'; out.id(this); if (base != 0) out.ref(first, "association", "EXT_"); else { write_visibility(out); write_scope(out); if (isReadOnly()) out << " isReadOnly=\"true\""; if (isDerived()) { out << " isDerived=\"true\""; if (isDerivedUnion()) out << " isDerivedUnion=\"true\""; } if (isOrdered()) out << " isOrdered=\"true\""; if (isUnique()) out << " isUnique=\"true\""; if (first->_assoc_class != 0) out.ref(first->_assoc_class, "association"); else out.ref(first, "association", "ASSOC_"); out << " aggregation=\""; if (this == first) { parent()->memo_relation(this); if (_gen_eclipse) { switch (relationKind()) { case anAggregation: case aDirectionalAggregation: out << "shared"; break; case anAggregationByValue: case aDirectionalAggregationByValue: out << "composite"; break; default: out << "none"; } } else out << "none"; } else if (_gen_eclipse) out << "none"; else { switch (relationKind()) { case anAggregation: case aDirectionalAggregation: out << "shared"; break; case anAggregationByValue: case aDirectionalAggregationByValue: out << "composite"; break; default: out << "none"; } } out << '"'; } out << ">\n"; out.indent(+1); out.indent(); out << "<type xmi:type=\"uml:Class\""; if (base != 0) { if (! base->propertyValue("metaclassPath", s)) s = (_uml_20) ? "http://schema.omg.org/spec/UML/2.0/uml.xml" : "http://schema.omg.org/spec/UML/2.1/uml.xml"; out << " href=\"" << s << '#' << base->name() << '"'; } else out.idref(roleType()); out << "/>\n"; write_multiplicity(out, multiplicity(), this); write_default_value(out, defaultValue(), this); write_constraint(out); write_annotation(out); write_description_properties(out); out.indent(-1); out.indent(); out << "</ownedAttribute>\n"; unload(); }
bool JSObject::getPrimitiveNumber(ExecState* exec, double& number, JSValue*& result) { result = defaultValue(exec, NumberType); number = result->toNumber(exec); return !result->isString(); }
void HTMLTextAreaElement::reset() { setValue(defaultValue()); m_isDirty = false; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RigCompletionData::isDefaultValue(double num) { return num == defaultValue(); }
void ParameterDefinition::setDefaultValues(ActionInstance *actionInstance) { actionInstance->setSubParameter(name().original(), "value", defaultValue()); }
QWidget * ExtArgNumber::createEditor(QWidget * parent) { QString storeValue; QString text = defaultValue(); if ( _argument->storeval ) { QString storeValue = _argument->storeval; if ( storeValue.length() > 0 && storeValue.compare(text) != 0 ) text = storeValue; } textBox = (QLineEdit *)ExtArgText::createEditor(parent); textBox->disconnect(SIGNAL(textChanged(QString))); if ( _argument->arg_type == EXTCAP_ARG_INTEGER || _argument->arg_type == EXTCAP_ARG_UNSIGNED ) { QIntValidator * textValidator = new QIntValidator(parent); if ( _argument->range_start != NULL ) { int val = 0; if ( _argument->arg_type == EXTCAP_ARG_INTEGER ) val = extcap_complex_get_int(_argument->range_start); else if ( _argument->arg_type == EXTCAP_ARG_UNSIGNED ) { guint tmp = extcap_complex_get_uint(_argument->range_start); if ( tmp > G_MAXINT ) { g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Defined value for range_start of %s exceeds valid integer range", _argument->call ); val = G_MAXINT; } else val = (gint)tmp; } textValidator->setBottom(val); } if ( _argument->arg_type == EXTCAP_ARG_UNSIGNED && textValidator->bottom() < 0 ) { g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "%s sets negative bottom range for unsigned value, setting to 0", _argument->call ); textValidator->setBottom(0); } if ( _argument->range_end != NULL ) { int val = 0; if ( _argument->arg_type == EXTCAP_ARG_INTEGER ) val = extcap_complex_get_int(_argument->range_end); else if ( _argument->arg_type == EXTCAP_ARG_UNSIGNED ) { guint tmp = extcap_complex_get_uint(_argument->range_end); if ( tmp > G_MAXINT ) { g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Defined value for range_end of %s exceeds valid integer range", _argument->call ); val = G_MAXINT; } else val = (gint)tmp; } textValidator->setTop(val); } textBox->setValidator(textValidator); } else if ( _argument->arg_type == EXTCAP_ARG_DOUBLE ) { QDoubleValidator * textValidator = new QDoubleValidator(parent); if ( _argument->range_start != NULL ) textValidator->setBottom(extcap_complex_get_double(_argument->range_start)); if ( _argument->range_end != NULL ) textValidator->setTop(extcap_complex_get_double(_argument->range_end)); textBox->setValidator(textValidator); } textBox->setText(text.trimmed()); connect(textBox, SIGNAL(textChanged(QString)), SLOT(onStringChanged(QString))); return textBox; }
QVariant ToConfiguration::Editor::defaultValue(int option) const { switch (option) { case SyntaxHighlightingInt: return QVariant((int) 0); case EditorTypeInt: return QVariant((int) 0); case UseMaxTextWidthMarkBool: return QVariant((bool) false); case MaxTextWidthMarkInt: return QVariant((int)75); case KeywordUpperBool: return QVariant((bool) false); case ObjectNamesUpperBool: return QVariant((bool) false); case CodeCompleteBool: return QVariant((bool) true); case CompleteSortBool: return QVariant((bool) true); case UseEditorShortcutsBool: return QVariant((bool) false); case EditorShortcutsMap: return QVariant(QMap<QString, QVariant>()); case AutoIndentBool: return QVariant((bool) true); case UseSpacesForIndentBool: return QVariant((bool) false); case TabStopInt: return QVariant((int) 8); case ConfTextFont: return QVariant(QString("")); case ConfCodeFont: { QFont fo; QFont mono; #if defined(Q_OS_WIN) mono = QFont("Courier New", 10); #elif defined(Q_OS_MAC) mono = QFont("Courier", 12); #else // TODO #endif mono.setStyleHint(QFont::Monospace, QFont::NoAntialias); fo = mono.resolve(fo); QString fontName = fo.toString(); return QVariant(fontName); } case ListTextFont: return QVariant(QString("")); case Extensions: return QVariant(QString("SQL (*.sql *.pkg *.pkb), Text (*.txt), All (*)")); case EditStyleMap: { static toStylesMap retval; if (!retval.isEmpty()) return QVariant::fromValue(retval); QMetaEnum StyleNameEnum(ENUM_REF(toSyntaxAnalyzer,WordClassEnum)); QsciLexerSQL *l = new QsciLexerSQL(NULL); for (int idx = 0; idx < StyleNameEnum.keyCount(); idx++) { QColor fg = l->color((int)StyleNameEnum.value(idx)); QColor bg = l->paper((int)StyleNameEnum.value(idx)); QFont fo = Utils::toStringToFont(defaultValue(ConfCodeFont).toString()); QString styleName = StyleNameEnum.key(idx); int styleNameEnum = StyleNameEnum.value(idx); retval.insert(styleNameEnum, toStyle(fg, bg, fo)); } delete l; return QVariant::fromValue(retval); } default: Q_ASSERT_X( false, qPrintable(__QHERE__), qPrintable(QString("Context Editor un-registered enum value: %1").arg(option))); return QVariant(); } }
void PluginSettingsLineEdit::load() { QString text = QSettings().value(key(), defaultValue()).toString(); setText(text); }
void HTMLTextAreaElement::reset() { setNonDirtyValue(defaultValue()); }
Color EditorSettings::GetColor(const String& colorName, const Color& defaultColor) const { Vector4 defaultValue(defaultColor.r, defaultColor.g, defaultColor.b, defaultColor.a); Vector4 colorValues = settings->GetVector4(colorName, defaultValue); return Color(colorValues.x, colorValues.y, colorValues.z, colorValues.w); }