本文整理汇总了C++中VectorMap类的典型用法代码示例。如果您正苦于以下问题:C++ VectorMap类的具体用法?C++ VectorMap怎么用?C++ VectorMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VectorMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Clear
void defMsg::Load( String filePath )
{
Clear() ;
path = filePath ;
name = GetFileTitle(path) ;
VectorMap<String,String> ini = LoadIniFile(path) ;
from = ini.Get("from") ;
subject = ini.Get("subject") ;
String s ;
for (int i = 0; true; i++)
{
s = ini.Get("body" + AsString(i), "") ;
if (s.IsEmpty())
break ;
qtfBody += s + "\r\n" ;
}
// guardamos este como último cargado
theCfg.lastMsg = path ;
theCfg.Save() ;
}
示例2:
VectorMap<String, Value> Pdb::DataMap(const ArrayCtrl& a)
{
VectorMap<String, Value> r;
for(int i = 0; i < a.GetCount(); i++)
r.Add(a.Get(i, 0), a.Get(i, 1));
return r;
}
示例3: PromptOK
void OutMode::CmdOptions()
{
const Workspace& wspc = ide.IdeWorkspace();
int pi = wspc.GetCount() > 0 ? 0 : -1;
if (pi < 0) {
PromptOK("No main package");
return;
}
VectorMap<String, String> bm = ide.GetMethodVars(~method);
if (bm.GetCount() == 0) {
PromptOK("Invalid build method");
return;
}
One<Host> host = ide.CreateHost(false);
One<Builder> b = ide.CreateBuilder(~host);
const String& p = wspc[pi];
String output = NativePath(ide.OutDir(ide.PackageConfig(wspc, pi, bm, ~config, *host, *b), p, bm, true));
if (output.Right(1) == ".")
output = output.Left(output.GetCount() - 1);
const ModePane& pane = ~mode == 0 ? debug : release;
int blitzpackage = pane.package.Get(0, 2);
bool blitzbuild = !wspc.package[pi].noblitz && pane.blitz
&& (IsNull(blitzpackage) ? true : blitzpackage);
CmdBuildOptionsWindow window(p, ~method, ~config, output,
~mode, ide.hydra1_threads, pane.linkmode, blitzbuild, pane.map, ide.console.verbosebuild);
LoadFromGlobal(window, "CmdBuildOptionsWindow");
window.GenerateCmd();
window.Run();
StoreToGlobal(window, "CmdBuildOptionsWindow");
}
示例4: SyncLock
void OutMode::Preset()
{
int q = ide.recent_buildmode.Find(~method);
SyncLock();
if(q < 0) {
VectorMap<String, String> map = GetMethodVars(~method);
debug.linkmode = atoi(map.Get("DEBUG_LINKMODE", "0"));
debug.debug = atoi(map.Get("DEBUG_INFO", "0"));
debug.blitz = MapFlag(map, "DEBUG_BLITZ");
release.linkmode = atoi(map.Get("RELEASE_LINKMODE", "0"));
release.debug <<= 0;
release.blitz = MapFlag(map, "RELEASE_BLITZ");
}
else {
StringStream ss(ide.recent_buildmode[q]);
TargetMode x;
String dummy;
int m;
ss / m;
ss % dummy;
ss / m;
mode = !!m;
ss % x;
debug.Load(x);
ss % x;
release.Load(x);
}
}
示例5: GetClipboardFormatCode
int GetClipboardFormatCode(const char *format_id)
{
GuiLock ___;
int x = (int)(intptr_t)format_id;
if(x >= 0 && x < 65535)
return x;
String fmt = format_id;
if(fmt == "text")
return CF_TEXT;
if(fmt == "wtext")
return CF_UNICODETEXT;
if(fmt == "dib")
return CF_DIB;
if(fmt == "files")
return CF_HDROP;
static StaticMutex m;
Mutex::Lock __(m);
static VectorMap<String, int> format_map;
int f = format_map.Find(format_id);
if(f < 0) {
f = format_map.GetCount();
format_map.Add(format_id,
#ifdef PLATFORM_WINCE
::RegisterClipboardFormat(ToSystemCharset(format_id))
#else
::RegisterClipboardFormat(format_id)
#endif
);
}
return format_map[f];
}
示例6: GetAllFacesSys
Vector<FaceInfo> GetAllFacesSys()
{
VectorMap<String, FaceInfo> list;
sList = &list;
list.Add("STDFONT").name = "STDFONT";
list.Top().info = 0;
#ifdef PLATFORM_WINCE
HDC hdc = CreateDC(NULL, NULL, NULL, NULL);
Win32_ForceFace(hdc, "Tahoma", NULL);
Win32_ForceFace(hdc, "Tahoma", "Tahoma");
Win32_ForceFace(hdc, "Courier New", "Tahoma");
Win32_ForceFace(hdc, "Tahoma", "Tahoma");
Win32_ForceFace(hdc, "Tahoma", "Tahoma");
Win32_ForceFace(hdc, "Tahoma", "Tahoma");
#else
HDC hdc = CreateIC("DISPLAY", NULL, NULL, NULL);
Win32_ForceFace(hdc, "Times New Roman", "Arial");
Win32_ForceFace(hdc, "Arial", "Arial");
Win32_ForceFace(hdc, "Courier New", "Arial");
Win32_ForceFace(hdc, "Symbol", "Arial");
Win32_ForceFace(hdc, "WingDings", "Arial");
Win32_ForceFace(hdc, "Tahoma", "Arial");
#endif
Win32_EnumFace(hdc, NULL);
DeleteDC(hdc);
return list.PickValues();
}
示例7: BenchNTL2
void BenchNTL2(const char *file, Stream& out) {
FileIn in(file);
if (!in) {
out << "Cannot open input file.\n";
return;
}
VectorMap<String, int> map;
for(;;) {
int c = in.Get();
if(c < 0) break;
if(IsAlpha(c) || c == '_') {
String id;
id.Cat(c);
c = in.Get();
while(c >= 0 && (IsAlNum(c) || c == '_')) {
id.Cat(c);
c = in.Get();
}
map.GetAdd(id, 0)++;
}
else
if(IsDigit(c))
do c = in.Get();
while(c >= 0 && (IsAlNum(c) || c == '.'));
}
Vector<int> order = GetSortOrder(map.GetKeys());
for(int i = 0; i < order.GetCount(); i++)
out << ~map.GetKey(order[i]) << ": " << map[order[i]] << '\n';
}
示例8: SetTransform
void SetTransform(const btTransform& aT, VectorMap<void*, int>& set){
if (set.Find(mSelf) != set.end())
return;
mSelf->setWorldTransform(aT);
mSelf->clearForces();
set[mSelf] = 1;
if (mGameFlag != 0)
Logger::Log(FB_DEFAULT_LOG_ARG, FormatString("(info) Setting rigid body transform for %d", mGameFlag).c_str());
auto numConstraints = mSelf->getNumConstraintRefs();
for (int i = 0; i < numConstraints; ++i){
auto con = mSelf->getConstraintRef(i);
auto conType = con->getConstraintType();
if (conType == FIXED_CONSTRAINT_TYPE || conType == D6_SPRING_2_CONSTRAINT_TYPE){
btFixedConstraint* fixedCon = (btFixedConstraint*)con;
auto a = &con->getRigidBodyA();
auto b = &con->getRigidBodyB();
auto trA = fixedCon->getFrameOffsetA();
auto trB = fixedCon->getFrameOffsetB();
if (b->getUserPointer() == mSelf){
std::swap(a, b);
std::swap(trA, trB);
}
auto bT = aT * trA * trB.inverse();
auto rigidBodyImpl = (RigidBodyImpl*)b->getUserPointer();
rigidBodyImpl->mImpl->SetTransform(bT, set);
}
}
mSelf->activate();
}
示例9: benchmark_VectorMap
void benchmark_VectorMap(const Vector<T>& key, const Vector<T>& fkey, int count)
{
StopTime();
cout << count << " items\n";
{
int i;
VectorMap<T, int> map;
StopTime();
for(i = 0; i < count; i++)
map.Add(key[i], i);
cout << "Adding done in " << StopTime() << " s\n";
for(int j = 0; j < 2; j++) {
for(i = 0; i < count; i++)
if(map.Get(fkey[i]) != i) {
cout << "ERROR !\n";
abort();
}
cout << "Search done in " << StopTime() << " s\n";
}
for(i = 0; i < count; i++)
map.UnlinkKey(key[i]);
cout << "Unlinking done in " << StopTime() << " s\n";
for(i = 0; i < count; i++)
map.Put(key[i], i);
cout << "Putting done in " << StopTime() << " s\n";
}
}
示例10: CreateHostRunDir
void Ide::BuildAndDebug0(const String& srcfile)
{
if(Build()) {
One<Host> h = CreateHostRunDir();
h->ChDir(GetFileFolder(target));
VectorMap<String, String> bm = GetMethodVars(method);
String dbg = bm.Get("DEBUGGER", Null);
if(IsNull(dbg)) {
if(bm.Get("BUILDER", Null) == "MSC71") {
String sln = ForceExt(target, ".sln");
if(GetFileLength(sln) > 0)
h->Launch("devenv \"" + h->GetHostPath(sln) + "\" "
// + "\"" + h->GetHostPath(srcfile) + "\"" //TRC, 2011/09/26: wrong devenv argument
);
else
h->Launch("devenv \"" + h->GetHostPath(target)
//+ "\" \"" + h->GetHostPath(srcfile) //TRC, 2011/09/26: wrong devenv argument
+ "\" /debugexe "
);
return;
}
dbg = "gdb";
}
else
h->Launch('\"' + dbg + "\" \""
// + h->GetHostPath(srcfile) + ' '
+ h->GetHostPath(target) + "\"", true);
}
}
示例11: LoadVarFile
bool LoadVarFile(const char *name, VectorMap<String, String>& _var)
{
try {
VectorMap<String, String> var;
String env = LoadFile(name);
CParser p(env);
while(!p.IsEof()) {
String v = p.ReadId();
p.Char('=');
if(p.IsString())
var.GetAdd(v) = p.ReadString();
else {
String ln;
while(p.PeekChar() != '\r' && p.PeekChar() != '\n' && p.PeekChar() != ';')
ln.Cat(p.GetChar());
var.GetAdd(v) = ln;
p.Spaces();
}
p.Char(';');
}
_var = pick(var);
return true;
}
catch(...) {
return false;
}
}
示例12: SaveVarFile
bool SaveVarFile(const char *filename, const VectorMap<String, String>& var)
{
FileOut out(filename);
for(int i = 0; i < var.GetCount(); i++)
out << var.GetKey(i) << " = " << AsCString(var[i]) << ";\n";
out.Close();
return !out.IsError();
}
示例13: SEGgradientInPsi
void SEGgradientInPsi(const VectorMap& psi, const deformableImage& I0, const Vector &ps, VectorMap &b, vector<_real> &resol)
{
Vector I ;
psi.multilinInterp(I0.img(), I) ;
psi.multilinInterpGradient(I0.img(), b) ;
b *= I ;
b*= ps ;
}
示例14: validateCustomizationString
bool ImageDesignManager::validateCustomizationString(CustomizationVariables* data, const String& appearanceFilename, int skillLevel) {
VectorMap<String, Reference<CustomizationVariable*> > variables;
variables.setNullValue(NULL);
AssetCustomizationManagerTemplate::instance()->getCustomizationVariables(appearanceFilename.hashCode(), variables, false);
if (variables.size() == 0) {
instance()->error("no customization data found for " + appearanceFilename);
return false;
}
for (int i = 0; i < data->size(); ++i) {
uint8 id = data->elementAt(i).getKey();
int16 val = data->elementAt(i).getValue();
String name = CustomizationIdManager::instance()->getCustomizationVariable(id);
//instance()->info("validating " + name + " with value " + String::valueOf(val), true);
CustomizationVariable* customizationVariable = variables.get(name).get();
if (customizationVariable == NULL) {
instance()->error("customization variable id " + String::valueOf(id) + " not found in the appearance file " + appearanceFilename + " with value " + String::valueOf(val));
continue;
}
PaletteColorCustomizationVariable* palette = dynamic_cast<PaletteColorCustomizationVariable*>(customizationVariable);
if (palette != NULL) {
if (!validatePalette(palette, val, skillLevel))
return false;
} else {
BasicRangedIntCustomizationVariable* range = dynamic_cast<BasicRangedIntCustomizationVariable*>(customizationVariable);
if (range == NULL) {
instance()->error("unkown customization variable type " + name);
return false;
} else {
int maxExcl = range->getMaxValueExclusive();
int minIncl = range->getMinValueInclusive();
if (val >= maxExcl || val < minIncl) {
instance()->error("variable outside bounds " + name + " value " + val + " outside bounds [" + String::valueOf(minIncl) + "," + String::valueOf(maxExcl) + ")");
return false;
} else {
//instance()->info("variable " + name + " value " + String::valueOf(val) + " inside bounds [" + String::valueOf(minIncl) + "," + String::valueOf(maxExcl) + ")", true);
}
}
}
//info("setting variable:" + name + " to " + String::valueOf(val), true);
}
return true;
}
示例15: DataMap
VectorMap<String, String> DataMap(const ArrayCtrl& data)
{
GuiLock __;
VectorMap<String, String> m;
for(int i = 0; i < data.GetCount(); i++)
m.Add(data.Get(i, 0), data.Get(i, 1));
return m;
}