UCVarValue FStringCVar::GetGenericRepDefault (ECVarType type) const { return FromString (DefaultValue, type); }
CAutoVoiceUser(const CString& sLine) { FromString(sLine); }
UCVarValue FStringCVar::GetGenericRep (ECVarType type) const { return FromString (Value, type); }
bool Vector3::FromString(const String& str) { return FromString(str.CString()); }
void Variant::FromString(VariantType type, const String& value) { return FromString(type, value.CString()); }
Guid& operator = (const GenericString& string) { FromString( string ); return *this; }
bool Graphics::Initialize(rapidxml::xml_node <>* node) { std::string str; unsigned int width, height, bpp; width = height = bpp = 0; bool fullScreen = false; if(!node ->first_node("WindowWidth")) { Error("WindowWidth not found in config file"); return false; } str = node ->first_node("WindowWidth") ->value(); if(!FromString(width, str)) { Error("Unable to parse WindowWidth in config file"); return false; } if(!node ->first_node("WindowHeight")) { Error("WindowHeight not found in config file"); return false; } str = node ->first_node("WindowHeight") ->value(); if(!FromString(height, str)) { Error("Unable to parse WindowHeight in config file"); return false; } if(!node ->first_node("BitsPerPixel")) { Error("BitsPerPixel not found in config file"); return false; } str = node ->first_node("BitsPerPixel") ->value(); if(!FromString(bpp, str)) { Error("Unable to parse BitsPerPixel in config file"); return false; } if(!node ->first_node("FullScreen")) { Error("FullScreen not found in config file"); return false; } str = node ->first_node("FullScreen") ->value(); if(str == "false") { fullScreen = false; } else if(str == "true") { fullScreen = true; } else { Error("Unable to parse FullScreen in config file"); return false; } return Initialize(width, height, bpp, fullScreen); }
/** * create the NPL file name object from a string. * The string is of the following file format * @param filename: [(sRuntimeStateName|gl)][sNID:]sRelativePath[@sDNSServerName] * the following is a list of all valid file name combinations: * "[email protected]:script/hello.lua" -- a file of user001 in its default gaming thread * "(world1)[email protected]:script/hello.lua" -- a file of server001 in its thread world1 * "(worker1)script/hello.lua" -- a local file in the thread worker1 * "(gl)script/hello.lua" -- a glia (local) file in the current runtime state's thread * "script/hello.lua" -- a file in the current thread. For a single threaded application, this is usually enough. */ NPLFileNameT(const char * filename){ FromString(filename); }
int main(int argc, char **argv) { try { std::string progname = argv[0]; // Process commandline options int argn; bool help = false; std::string outdir; std::string configfilename; std::string delta; khGetopt options; options.flagOpt("help", help); options.flagOpt("?", help); options.opt("output", outdir); options.opt("config", configfilename, &khGetopt::FileExists); options.opt("delta", delta, &khGetopt::DirExists); if (!options.processAll(argc, argv, argn)) usage(progname); if (help) usage(progname); if (argn != argc) usage(progname); // Validate commandline options if (!outdir.size()) { usage(progname, "No output specified"); } if (!configfilename.size()) { usage(progname, "No --config specified"); } if (delta.size()) { notify(NFY_FATAL, "--delta not supported yet."); } geFilePool file_pool; geindexgen::UnifiedConfig config; if (!config.Load(configfilename)) { usage(progname, "Unable to load %s", configfilename.c_str()); } // Print the input file sizes for diagnostic log file info. // Here we want to take in the sizes of the indexes from the config file. std::vector<std::string> input_files; input_files.push_back(configfilename); for (std::vector<geindexgen::UnifiedConfig::Entry>::const_iterator entry = config.indexes_.begin(); entry != config.indexes_.end(); ++entry) { input_files.push_back(entry->indexdir_); } khPrintFileSizes("Input File Sizes", input_files); // create the writer geindex::UnifiedWriter writer(file_pool, outdir, geindex::UnifiedWriter::FullIndexMode, kUnifiedType); geindex::UnifiedWriter::ReadBuffer tmp_read_buf; // pre-populate this for delta index operations // leave empty for new indexes std::map<std::string, uint32> unified_filemap; // progress meter - will need to be modified a bit when // incremental updates are implemented (TODO: mikegoss) khProgressMeter progress_meter(0, "entries"); // will be filled in with the mapping from old file numbers to new // file numbers std::vector<std::vector<uint32> > translated_filenums; translated_filenums.resize(config.indexes_.size()); std::map<std::string, uint32> dated_imagery_channels_map; typedef geindex::AdaptingTraverserBase<geindex::UnifiedBucket>::MergeEntry MergeEntryType; typedef Merge<MergeEntryType> MergeType; MergeType merger("UnifiedIndex Merger"); uint source_id = 0; for (std::vector<geindexgen::UnifiedConfig::Entry>::const_iterator entry = config.indexes_.begin(); entry != config.indexes_.end(); ++entry, ++source_id) { std::string entry_type = entry->type_; geindex::TypedEntry::TypeEnum type; FromString(entry->type_, type); if (type == geindex::TypedEntry::Imagery || type == geindex::TypedEntry::DatedImagery) { // For DatedImagery, keep track of the date to channel map. dated_imagery_channels_map[entry->date_string_] = entry->channel_id_; typedef geindex::Traverser<geindex::BlendBucket> BlendTraverser; khTransferGuard<BlendTraverser> traverser = TransferOwnership(new BlendTraverser( "ImageryTraverser", file_pool, entry->indexdir_)); PopulateFilenumTranslations(writer, unified_filemap, translated_filenums[source_id], progress_meter, traverser->GetIndexBundleReader()); merger.AddSource( TransferOwnership( new geindex::UnifiedAdaptingTraverser<BlendTraverser>( "ImageryAdaptingTraverser", geindex::TypedEntry::Imagery, traverser, entry->channel_id_, entry->version_))); } else if (type == geindex::TypedEntry::Terrain) { #if 1 if (!PacketFile::IsPacketFile(entry->indexdir_)) { throw khException( kh::tr("INTERNAL ERROR: Terrain path must be a packetfile: %1") .arg(entry->indexdir_)); } // register packetfile PopulatePacketfileFilenumTranslations(writer, unified_filemap, translated_filenums[source_id], progress_meter, entry->indexdir_); // make and adapting traverser merger.AddSource( TransferOwnership( new geindex::UnifiedPacketFileAdaptingTraverser( file_pool, "TerrainPacketAdaptingTraverser", geindex::TypedEntry::Terrain, entry->version_, entry->channel_id_, entry->indexdir_))); #else typedef geindex::Traverser<geindex::CombinedTmeshBucket> CombinedTmeshTraverser; khTransferGuard<CombinedTmeshTraverser> traverser = TransferOwnership(new CombinedTmeshTraverser( "TerrainTraverser", file_pool, entry->indexdir_)); PopulateFilenumTranslations(writer, unified_filemap, translated_filenums[source_id], progress_meter, traverser->GetIndexBundleReader()); merger.AddSource( TransferOwnership( new geindex::UnifiedAdaptingTraverser<CombinedTmeshTraverser>( "TerrainAdaptingTraverser", geindex::TypedEntry::Terrain, traverser, entry->channel_id_, entry->version_))); #endif } else if (type == geindex::TypedEntry::VectorGE) { typedef geindex::Traverser<geindex::VectorBucket> VectorTraverser; khTransferGuard<VectorTraverser> traverser = TransferOwnership(new VectorTraverser( "VectorTraverser", file_pool, entry->indexdir_)); PopulateFilenumTranslations(writer, unified_filemap, translated_filenums[source_id], progress_meter, traverser->GetIndexBundleReader()); merger.AddSource( TransferOwnership( new geindex::UnifiedAdaptingTraverser<VectorTraverser>( "VectorGEAdaptingTraverser", geindex::TypedEntry::VectorGE, traverser, 0 /* unused override channel id */, 0 /* unused override version */))); } else if (type == geindex::TypedEntry::VectorMaps) { if (!PacketFile::IsPacketFile(entry->indexdir_)) { throw khException( kh::tr("INTERNAL ERROR: VectorMaps " "path must be a packetfile: %1") .arg(entry->indexdir_)); } // register packetfile PopulatePacketfileFilenumTranslations(writer, unified_filemap, translated_filenums[source_id], progress_meter, entry->indexdir_); // make and adapting traverser that uses the packetfile // number from above merger.AddSource( TransferOwnership( new geindex::UnifiedPacketFileAdaptingTraverser( file_pool, "VectorMapsAdaptingTraverser", geindex::TypedEntry::VectorMaps, entry->version_, entry->channel_id_, entry->indexdir_))); } else if (type == geindex::TypedEntry::VectorMapsRaster) { if (!PacketFile::IsPacketFile(entry->indexdir_)) { throw khException( kh::tr("INTERNAL ERROR: VectorMapsRaster " "path must be a packetfile: %1") .arg(entry->indexdir_)); } // register packetfile PopulatePacketfileFilenumTranslations(writer, unified_filemap, translated_filenums[source_id], progress_meter, entry->indexdir_); // make and adapting traverser that uses the packetfile // number from above merger.AddSource( TransferOwnership( new geindex::UnifiedPacketFileAdaptingTraverser( file_pool, "VectorMapsRasterAdaptingTraverser", geindex::TypedEntry::VectorMapsRaster, entry->version_, entry->channel_id_, entry->indexdir_))); } else if (type == geindex::TypedEntry::QTPacket || type == geindex::TypedEntry::QTPacket2) { if (!PacketFile::IsPacketFile(entry->indexdir_)) { throw khException( kh::tr("INTERNAL ERROR: QTPacket path must be a packetfile: %1") .arg(entry->indexdir_)); } // register packetfile PopulatePacketfileFilenumTranslations(writer, unified_filemap, translated_filenums[source_id], progress_meter, entry->indexdir_); // make and adapting traverser that uses the packetfile // number from above merger.AddSource( TransferOwnership( new geindex::UnifiedPacketFileAdaptingTraverser( file_pool, "QTPacketAdaptingTraverser", type, entry->version_, 0 /* channel */, entry->indexdir_))); } else if (type == geindex::TypedEntry::Unified) { typedef geindex::Traverser<geindex::UnifiedBucket> UnifiedTraverser; khTransferGuard<UnifiedTraverser> traverser = TransferOwnership(new UnifiedTraverser( "VectorMapsTraverser", file_pool, entry->indexdir_)); PopulateFilenumTranslations(writer, unified_filemap, translated_filenums[source_id], progress_meter, traverser->GetIndexBundleReader()); merger.AddSource(traverser); } else { throw khException( kh::tr("INTERNAL ERROR: Unknown input type: %1") .arg(entry->type_)); } } // perform the merge merger.Start(); do { const MergeEntryType &slot = merger.Current(); uint source_id = merger.CurrentSourceId(); for (uint i = 0; i < slot.size(); ++i) { geindex::TypedEntry entry = slot[i]; entry.dataAddress.fileNum = translated_filenums[source_id][entry.dataAddress.fileNum]; writer.Put(slot.qt_path(), entry, tmp_read_buf); } progress_meter.incrementDone(slot.size()); } while (merger.Advance()); merger.Close(); writer.Close(); // Write the dated_imagery_channels.txt // only if we have more than 1 dated imagery layer. if (dated_imagery_channels_map.size() > 1) { std::string dated_channels_file_name = outdir + "/" + kDatedImageryChannelsFileName; notify(NFY_DEBUG, "Writing Dated Imagery channels to:\n %s", dated_channels_file_name.c_str()); FILE* fp = fopen(dated_channels_file_name.c_str(), "w"); std::map<std::string, uint32>::const_iterator iter = dated_imagery_channels_map.begin(); for (; iter != dated_imagery_channels_map.end(); ++iter) { fprintf(fp, "%s %d\n", iter->first.c_str(), iter->second); } fclose(fp); } // On successful completion, print out the output file sizes. std::vector<std::string> output_files; output_files.push_back(outdir); khPrintFileSizes("Output File Sizes", output_files); } catch (const khAbortedException &e) { notify(NFY_FATAL, "Unable to proceed: See previous warnings"); } catch (const std::exception &e) { notify(NFY_FATAL, "%s", e.what()); } catch (...) { notify(NFY_FATAL, "Unknown error"); } return 0; }
sockAddrBase::sockAddrBase(bool allowPort, const char *str) : m_allowPort(allowPort) { FromString(str); }
sockAddrBase::sockAddrBase(bool allowPort, const char *str, in_port_t port) : m_allowPort(allowPort) { FromString(str, port); }
IPAddress::IPAddress(const std::string& addr) : dataLen(0) { FromString(addr); }
bool FVariantData::FromJson(const TSharedRef<FJsonObject>& JsonObject) { bool bResult = false; const TCHAR* TypeStr = TEXT("Type"); const TCHAR* ValueStr = TEXT("Value"); FString VariantTypeStr; if (JsonObject->TryGetStringField(TypeStr, VariantTypeStr) && !VariantTypeStr.IsEmpty()) { if (VariantTypeStr.Equals(EOnlineKeyValuePairDataType::ToString(EOnlineKeyValuePairDataType::Int32))) { int32 FieldValue; if (JsonObject->TryGetNumberField(ValueStr, FieldValue)) { SetValue(FieldValue); bResult = true; } } else if (VariantTypeStr.Equals(EOnlineKeyValuePairDataType::ToString(EOnlineKeyValuePairDataType::Float))) { double FieldValue; if (JsonObject->TryGetNumberField(ValueStr, FieldValue)) { SetValue((float)FieldValue); bResult = true; } } else if (VariantTypeStr.Equals(EOnlineKeyValuePairDataType::ToString(EOnlineKeyValuePairDataType::String))) { FString FieldValue; if (JsonObject->TryGetStringField(ValueStr, FieldValue)) { SetValue(FieldValue); bResult = true; } } else if (VariantTypeStr.Equals(EOnlineKeyValuePairDataType::ToString(EOnlineKeyValuePairDataType::Bool))) { bool FieldValue; if (JsonObject->TryGetBoolField(ValueStr, FieldValue)) { SetValue(FieldValue); bResult = true; } } else if (VariantTypeStr.Equals(EOnlineKeyValuePairDataType::ToString(EOnlineKeyValuePairDataType::Int64))) { FString FieldValue; if (JsonObject->TryGetStringField(ValueStr, FieldValue)) { Type = EOnlineKeyValuePairDataType::Int64; bResult = FromString(FieldValue); } } else if (VariantTypeStr.Equals(EOnlineKeyValuePairDataType::ToString(EOnlineKeyValuePairDataType::Double))) { double FieldValue; if (JsonObject->TryGetNumberField(ValueStr, FieldValue)) { SetValue(FieldValue); bResult = true; } } } return bResult; }
void ShaderLibFile::Load(String fileName) { String src = File::ReadAllText(fileName); FromString(src); }
cSatCableNumbers::cSatCableNumbers(int Size, const char *s) { size = Size; array = MALLOC(int, size); FromString(s); }
CAutoOpUser(const CString& sLine) { FromString(sLine); }
bool IntVector2::FromString(const String& str) { return FromString(str.CString()); }
void Variant::FromString(const String& type, const String& value) { return FromString(GetTypeFromName(type), value.CString()); }
UFromStringFormat USettings::GetParameter(const QString& parameter) { if (Parameters.find(parameter) == Parameters.end()) { throw UException("Parameter not found in config"); } return FromString(Parameters[parameter]); }
void Variant::FromString(const char* type, const char* value) { return FromString(GetTypeFromName(type), value); }
bool wxNativeFontInfo::FromUserString(const wxString& s) { return FromString( s ); }
// Constructor using a two character string ("Ac" or "Jd") Card::Card(char* buffer) { if (buffer) FromString(buffer); else Reset(); }