void FlagArgument::display(){ if((strcmp(getLongName().c_str(), "") != 0) && (getShortName() != ' ')) std::cout << "Flag (--" << getLongName() << " or -" << getShortName() << ") = " << *m_value << std::endl; else if(strcmp(getLongName().c_str(), "") == 0) std::cout << "Flag (-" << getShortName() << ") = " << *m_value << std::endl; else if(getShortName() == ' ') std::cout << "Flag (--" << getLongName() << ") = " << *m_value << std::endl; };
void MarkerSection::dump(std::ostream& out) const { out << getPrettyName() << ":" << std::endl; out << " name = " << getLongName() << std::endl; out << " prefix = " << prefix << std::endl; out << " title_format = " << title_format << std::endl; out << " text_format = " << text_format << std::endl; out << " icon = " << icon << std::endl; out << " icon_size = " << icon_size << std::endl; out << " match_empty = " << match_empty << std::endl; out << " show_default = " << show_default << std::endl; }
QVariant SkyObjItem::data(int role) { switch(role) { case DispNameRole: return getLongName(); case CategoryRole: return getType(); case CategoryNameRole: return getTypeName(); default: return QVariant(); } }
std::string MapcrafterConfigHelper::generateTemplateJavascript() const { std::string js = ""; auto maps = config.getMaps(); for (auto it = maps.begin(); it != maps.end(); ++it) { auto world = config.getWorld(it->getWorld()); js += "\"" + it->getShortName() + "\" : {\n"; js += "\tname: \"" + it->getLongName() + "\",\n"; js += "\tworld: \"" + it->getWorld() + "\",\n"; js += "\tworldName: \"" + world.getWorldName() + "\",\n"; js += "\ttextureSize: " + util::str(it->getTextureSize()) + ",\n"; js += "\ttileSize: " + util::str(32 * it->getTextureSize()) + ",\n"; js += "\tmaxZoom: " + util::str(getMapZoomlevel(it->getShortName())) + ",\n"; js += "\timageFormat: \"" + it->getImageFormatSuffix() + "\",\n"; js += "\trotations: ["; auto rotations = it->getRotations(); for (auto it2 = rotations.begin(); it2 != rotations.end(); ++it2) js += util::str(*it2) + ","; js += "],\n"; std::string tile_offsets = "["; auto offsets = world_tile_offsets.at(it->getWorld()); for (auto it2 = offsets.begin(); it2 != offsets.end(); ++it2) tile_offsets += "[" + util::str(it2->getX()) + ", " + util::str(it2->getY()) + "], "; tile_offsets += "]"; js += "\ttileOffsets: " + tile_offsets + ",\n"; if (!world.getDefaultView().empty()) js += "\tdefaultView: [" + world.getDefaultView() + "],\n"; if (world.getDefaultZoom() != 0) js += "\tdefaultZoom: " + util::str(world.getDefaultZoom()) + ",\n"; if (world.getDefaultRotation() != -1) js += "\tdefaultRotation: " + util::str(world.getDefaultRotation()) + ",\n"; js += "},"; } return js; }
ossimString ossimWatermarkFilter::getDescription() const { ossimString description; description = getLongName(); description += "\n"; description += "Valid modes:\n"; vector<ossimString> list; getModeList(list); vector<ossimString>::const_iterator i = list.begin(); while (i != list.end()) { description +=(*i); description += "\n"; ++i; } return description; }
int arread( int (*rf)( void *data, int len ), void (*process_f)(const char *fname, void *data, int len) ) { char *nametab = 0; char *arIndex = 0; char ghbuf[GHSIZE]; struct arreader a; if( GHSIZE != rf( ghbuf, GHSIZE )) { die( &a, "no hdr"); } while(1) { char fhbuf[FHSIZE]; int ret = rf( fhbuf, FHSIZE ); if( ret == 0 ) break; if( FHSIZE != ret ) { die( &a, "no fhdr"); } char r_fname[17]; strlcpy( r_fname, fhbuf, 16 ); char r_fsize[10]; strlcpy( r_fsize, fhbuf+48, 9 ); if( fhbuf[58] != 0x60u || fhbuf[59] != 0x0Au ) { //hexdump(fhbuf, FHSIZE, "", 0); printf("name '%s', size '%s' magic: %x %x\n", r_fname, r_fsize, fhbuf[58], fhbuf[59] ); die( &a, "no file magic" ); } //printf("name '%s', size '%s'\n", r_fname, r_fsize ); //printf("name '%s'\n", r_fname ); int size = (int)atol(r_fsize); pack((unsigned char *)r_fname); //printf("name '%s'\n", r_fname ); int isSlash = !strcmp( r_fname, "/" ); if(isSlash) { /* char *arIndex = calloc( size+1, 1 ); if( arIndex == 0 || size != rf( arIndex, size ) ) die( &a, "can't load /"); */ arIndex = loadall( &a, rf, size ); //printf("/=\n'%.*s'\n", size, arIndex ); parseIndex( &a, arIndex, size); } int isSlashSlash = !strcmp( r_fname, "//" ); if(isSlashSlash) { /* nametab = calloc( size+1, 1 ); if( nametab == 0 || size != rf( nametab, size ) ) die( &a, "can't load //"); */ nametab = loadall( &a, rf, size ); //printf("//=\n%.*s\n", size, nametab ); } char *fname = r_fname; if( r_fname[0] == '/' && r_fname[1] ) fname = getLongName( &a, nametab, (int) atol(r_fname+1) ); if(!isSlashSlash && !isSlash) { //rdata( rf, size, fname ); void *d = loadall( &a, rf, size ); process_f( fname, d, size ); free(d); } // align at 2 bytes if( size & 1 ) rf( fhbuf, 1 ); } if(nametab) free(nametab); if(arIndex) free(arIndex); return 0; /* die: if(nametab) free(nametab); if(arIndex) free(arIndex); return -1; */ }
const string Message::toString() const { return getLongName(); }
std::string SyntaxTree::TreeNode::print(short depth, const std::string &search_string, bool &found) { std::string doc; std::string long_name(getLongName()); std::string name(_syntax_tree.isLongNames() ? long_name : _name); std::string out; if (depth < 0) { for (const auto & c_it : _children) { bool local_found = false; std::string local_out (c_it.second->print(depth+1, search_string, local_found)); found |= local_found; // Update the current frame's found variable if (local_found) out += local_out; } return out; } // GlobalParamsAction is special - we need to just always print it out // if (_name == "GlobalParamsAction") // found = true; std::string indent((depth+1)*2, ' '); std::multimap<std::string, InputParameters *>::const_iterator it = _moose_object_params.begin(); do { bool local_found = false; std::string local_out; // Compare the block name, if it's matched we are going to pass an empty search string // which means match ALL parameters std::string local_search_string; if (wildCardMatch(name, search_string)) found = true; else local_search_string = search_string; if (it != _moose_object_params.end()) doc = it->second->getClassDescription(); else doc = ""; local_out += _syntax_tree.printBlockOpen(name, depth, doc); for (const auto & a_it : _action_params) if (a_it.first != "EmptyAction") { local_out += _syntax_tree.printParams(name, long_name, *(a_it.second), depth, local_search_string, local_found); found |= local_found; // Update the current frame's found variable //DEBUG // Moose::out << "\n" << indent << "(" << ait->first << ")"; //DEBUG } if (it != _moose_object_params.end()) { local_out += _syntax_tree.printParams(name, long_name, *it->second, depth, local_search_string, local_found); found |= local_found; //DEBUG // Moose::out << "\n" << indent << "{" << it->first << "}"; //DEBUG } local_out += _syntax_tree.preTraverse(depth); for (const auto & c_it : _children) { bool child_found = false; std::string child_out (c_it.second->print(depth+1, local_search_string, child_found)); found |= child_found; // Update the current frame's found variable if (child_found) local_out += child_out; } local_out += _syntax_tree.printBlockClose(name, depth); if (found) out += local_out; // If there are no moose object params then we have to be careful about how we // increment the iterator. We only want to increment if we aren't already // at the end. } while (it != _moose_object_params.end() && ++it != _moose_object_params.end()); return out; }
std::string Item::getDescription(const ItemType& it, const int32_t& lookDistance, const Item* item /*= NULL*/, int32_t subType /*= -1*/, bool addArticle /*= true*/) { std::stringstream s; if (item) { subType = item->getSubType(); } s << getLongName(it, lookDistance, item, subType, addArticle); if (it.isRune()) { s << " (\"" << it.runeSpellName << "\")."; if (it.runeLevel > 0 || it.runeMagLevel > 0) { s << std::endl << "It can only be used with"; if (it.runeLevel > 0) { s << " level " << it.runeLevel; } if (it.runeMagLevel > 0) { if (it.runeLevel > 0) { s << " and"; } s << " magic level " << it.runeMagLevel; } s << " or higher."; } } else if (it.weaponType != WEAPON_NONE) { if (it.weaponType == WEAPON_DIST && it.amuType != AMMO_NONE) { s << " (Range:" << it.shootRange; if (it.attack != 0) { s << ", Atk" << std::showpos << it.attack << std::noshowpos; } if (it.hitChance > 0) //excludes both cases it.hitchance 0 and -1 { s << ", Hit%" << std::showpos << it.hitChance << std::noshowpos; } s << ")"; } else if (it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND) // Arrows and Bolts doesn't show atk { s << " ("; if (it.attack != 0) { s << "Atk:" << (int32_t)it.attack; if (it.abilities.elementDamage != 0) { s << " " << "physical + "; switch (it.abilities.elementType) { case COMBAT_ICEDAMAGE: s << it.abilities.elementDamage << " Ice,"; break; case COMBAT_EARTHDAMAGE: s << it.abilities.elementDamage << " Earth,"; break; case COMBAT_FIREDAMAGE: s << it.abilities.elementDamage << " Fire,"; break; case COMBAT_ENERGYDAMAGE: s << it.abilities.elementDamage << " Energy,"; break; default: s << it.abilities.elementDamage << " Unknown,"; break; } } } if (it.defense != 0 || it.extraDef != 0) { if (it.attack != 0) { s << " "; } s << "Def:" << (int32_t)it.defense; if (it.extraDef != 0) { s << " " << std::showpos << (int32_t)it.extraDef << std::noshowpos; } } if (it.abilities.stats[STAT_MAGICPOINTS] != 0) { if (it.attack != 0 || it.defense != 0 || it.extraDef != 0) { s << ", "; } s << "magic level " << std::showpos << (int32_t)it.abilities.stats[STAT_MAGICPOINTS] << std::noshowpos; } s << ")"; } if (it.showCharges) { if (subType > 1) { s << " that has " << (int32_t)subType << " charges left"; } else { s << " that has 1 charge left"; } } s << "."; } else if (it.armor != 0 || it.abilities.skill.any() || it.abilities.absorb.any() || it.abilities.stats[STAT_MAGICPOINTS] != 0 || it.abilities.speed != 0 || it.defense != 0) { if (it.showCharges) { if (subType > 1) { s << " that has " << (int32_t)subType << " charges left"; } else { s << " that has 1 charge left"; } } else if (it.showDuration) { if (item && item->hasAttribute(ATTR_ITEM_DURATION)) { int32_t duration = item->getDuration() / 1000; s << " that has energy for "; if (duration >= 120) { s << duration / 60 << " minutes left."; } else if (duration > 60) { s << "1 minute left."; } else { s << "less than a minute left."; } } else { s << " that is brand-new."; } } s << " ("; bool prevDesc = false; if (it.armor != 0) { // as it is the first desc it isn't // really necessary to add it here //if(prevDesc) // s << ", "; s << "Arm:" << it.armor; prevDesc = true; } if (it.abilities.skill.any()) { if (prevDesc) { s << ", "; } it.abilities.skill.getDescription(s); prevDesc = true; } if (it.abilities.absorb.any()) { if (prevDesc) { s << ", "; } s << "protection"; it.abilities.absorb.getDescription(s); prevDesc = true; } if (it.abilities.stats[STAT_MAGICPOINTS] != 0) { if (prevDesc) { s << ", "; } s << "magic level " << std::showpos << (int32_t)it.abilities.stats[STAT_MAGICPOINTS] << std::noshowpos; prevDesc = true; } if (it.defense != 0) { if (prevDesc) { s << ", "; } s << "defense " << std::showpos << (int32_t)it.defense << std::noshowpos; prevDesc = true; } if (it.abilities.speed != 0) { if (prevDesc) { s << ", "; } s << "speed " << std::showpos << (int32_t)(it.abilities.speed / 2) << std::noshowpos; // last desc... same thing as the first //prevDesc = true; } s << ")."; } else if (it.isFluidContainer()) { if (subType > 0) { s << " of " << items[subType].name << "."; } else { s << ". It is empty."; } } else if (it.isSplash()) { s << " of "; if (subType > 0) { s << items[subType].name << "."; } else { s << items[1].name << "."; } } else if (it.isContainer()) { s << " (Vol:" << (int32_t)it.maxItems << ")."; } else if (it.isKey()) { if (item) { s << " (Key:" << (int32_t)item->getActionId() << ")."; } else { s << " (Key:0)."; } } else if (it.allowDistRead) { s << std::endl; if (item && item->getText() != "") { if (lookDistance <= 4) { if (item->getWriter().length()) { s << item->getWriter() << " wrote"; time_t wDate = item->getWrittenDate(); if (wDate > 0) { char date[16]; formatDateShort(wDate, date); s << " on " << date; } s << ": "; } else { s << "You read: "; } s << item->getText(); } else { s << "You are too far away to read it."; } } else { s << "Nothing is written on it."; } } else if (it.isLevelDoor() && item && item->getActionId() >= 1000) { s << " for level " << item->getActionId() - 1000; } else if (it.showCharges) { if (subType > 1) { s << " that has " << (int32_t)subType << " charges left."; } else { s << " that has 1 charge left."; } } else if (it.showDuration) { if (item && item->hasAttribute(ATTR_ITEM_DURATION)) { int32_t duration = item->getDuration() / 1000; s << " that has energy for "; if (duration >= 120) { s << duration / 60 << " minutes left."; } else if (duration > 60) { s << "1 minute left."; } else { s << "less than a minute left."; } } else { s << " that is brand-new."; } } else { s << "."; } if (it.wieldInfo != 0) { s << std::endl << "It can only be wielded properly by "; if (it.wieldInfo & WIELDINFO_PREMIUM) { s << "premium "; } if (it.wieldInfo & WIELDINFO_VOCREQ) { s << it.vocationString; } else { s << "players"; } if (it.wieldInfo & WIELDINFO_LEVEL) { s << " of level " << (int32_t)it.minReqLevel << " or higher"; } if (it.wieldInfo & WIELDINFO_MAGLV) { if (it.wieldInfo & WIELDINFO_LEVEL) { s << " and"; } else { s << " of"; } s << " magic level " << (int32_t)it.minReqMagicLevel << " or higher"; } s << "."; } if (lookDistance <= 1) { double weight = (!item ? it.weight : item->getWeight()); if (weight > 0) { s << std::endl << getWeightDescription(it, weight); } } if (item && item->getSpecialDescription() != "") { s << std::endl << item->getSpecialDescription().c_str(); } else if (it.description.length() && lookDistance <= 1) { s << std::endl << it.description; } else if(it.isFluidContainer() && subType > 0 && items[subType].description.length() && lookDistance <= 1) { s << std::endl << items[subType].description; } return s.str(); }
std::string Item::getLongName() const { const ItemType& it = items[id]; return getLongName(it, 0, this); }
ossimString ossimObject::getDescription()const { return getLongName(); }