本文整理汇总了C++中Preferences::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ Preferences::GetString方法的具体用法?C++ Preferences::GetString怎么用?C++ Preferences::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::GetString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preferencesFile
/**
* If we write a new networktables.ini with some sample values, test that
* we get those same values back using the Preference class.
*/
TEST(PreferencesTest, ReadPreferencesFromFile) {
NetworkTable::Shutdown();
std::remove(kFileName);
std::ofstream preferencesFile(kFileName);
preferencesFile << "[NetworkTables Storage 3.0]" << std::endl;
preferencesFile
<< "string \"/Preferences/testFileGetString\"=\"Hello, preferences file\""
<< std::endl;
preferencesFile << "double \"/Preferences/testFileGetInt\"=1" << std::endl;
preferencesFile << "double \"/Preferences/testFileGetDouble\"=0.5"
<< std::endl;
preferencesFile << "double \"/Preferences/testFileGetFloat\"=0.25"
<< std::endl;
preferencesFile << "boolean \"/Preferences/testFileGetBoolean\"=true"
<< std::endl;
preferencesFile
<< "double \"/Preferences/testFileGetLong\"=1000000000000000000"
<< std::endl;
preferencesFile.close();
NetworkTable::Initialize();
Preferences* preferences = Preferences::GetInstance();
EXPECT_EQ("Hello, preferences file",
preferences->GetString("testFileGetString"));
EXPECT_EQ(1, preferences->GetInt("testFileGetInt"));
EXPECT_FLOAT_EQ(0.5, preferences->GetDouble("testFileGetDouble"));
EXPECT_FLOAT_EQ(0.25f, preferences->GetFloat("testFileGetFloat"));
EXPECT_TRUE(preferences->GetBoolean("testFileGetBoolean"));
EXPECT_EQ(1000000000000000000ll, preferences->GetLong("testFileGetLong"));
}
示例2: LoadPreferences
/*
* Load preferences from config file
*/
void PrefsDialog::LoadPreferences(void)
{
Preferences* pPrefs = ((MyApp*)wxTheApp)->GetPrefs();
assert(pPrefs != NULL);
/*
* Load preferences.
*/
mConfigFile = ((MyApp*)wxTheApp)->GetConfigFileName();
pPrefs->GetDouble("gamma", &mGammaCorrection);
pPrefs->GetString("debugger", /*ref*/ mDebugger);
pPrefs->GetString("valgrinder", /*ref*/ mValgrinder);
pPrefs->GetBool("auto-power-on", &mAutoPowerOn);
pPrefs->GetBool("enable-sound", &mEnableSound);
pPrefs->GetBool("enable-fake-camera", &mEnableFakeCamera);
}
示例3: getPreferences
// Read data from the Preferences Panel
void getPreferences()
{
kLeftP = prefs->GetDouble("kLeftP", 0.025);
kLeftI = prefs->GetDouble("kLeftI", 0.0);
kLeftD = prefs->GetDouble("kLeftD", 0.2);
kLeftF = prefs->GetDouble("kLeftF", 0.03);
kLeftLowRPM = prefs->GetDouble("kLeftLowRPM", -1000.0);
kLeftHighRPM = prefs->GetDouble("kLeftHighRPM", -2400.0);
kRightP = prefs->GetDouble("kRightP", 0.025);
kRightI = prefs->GetDouble("kRightI", 0.0);
kRightD = prefs->GetDouble("kRightD", 0.2);
kRightF = prefs->GetDouble("kRightF", 0.03);
kRightLowRPM = prefs->GetDouble("kRightLowRPM", 1000.0);
kRightHighRPM = prefs->GetDouble("kRightHighRPM", 2400.0);
kLaunchP = prefs->GetDouble("kLaunchP", 0.2);
kLaunchI = prefs->GetDouble("kLaunchI", 0.004);
kLaunchD = prefs->GetDouble("kLaunchD", 0.5);
kLaunchF = prefs->GetDouble("kLaunchF", 0.0);
kGatherP = prefs->GetDouble("kGatherP", 0.05);
kGatherI = prefs->GetDouble("kGatherI", 0.0);
kGatherD = prefs->GetDouble("kGatherD", 0.1);
kGatherF = prefs->GetDouble("kGatherF", 0.0);
kTurnP = prefs->GetDouble("kTurnP", 0.025);
kTurnI = prefs->GetDouble("kTurnI", 0.004);
kTurnD = prefs->GetDouble("kTurnD", 0.06);
kTurnF = prefs->GetDouble("kTurnF", 0.0);
kGatherAngle = prefs->GetDouble("kGatherAngle", 113.0);
kLaunchMinAngle = prefs->GetDouble("kLaunchMinAngle", 23.5);
kLaunchMaxAngle = prefs->GetDouble("kLaunchMaxAngle", 36.7);
kLaunchAngle = prefs->GetDouble("kLaunchAngle", 30.0);
kCoeff0 = prefs->GetDouble("kCoeff0", 0.144);
kCoeff1 = prefs->GetDouble("kCoeff1", 19.8);
kLogLevel = prefs->GetString("kLogLevel", "INFO");
Log::SetLevel(Log::FromString(kLogLevel));
LOGGER(INFO) << "[getPreferences] LeftRPM:" << kLeftHighRPM << " RightRPM: " << kRightHighRPM;
}