mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
Initial commit
This commit is contained in:
6
blacklib/samples/config/CMakeLists.txt
Normal file
6
blacklib/samples/config/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
FILE(GLOB SRC *.cpp)
|
||||
|
||||
ADD_EXECUTABLE(sample_config ${SRC})
|
||||
|
||||
TARGET_LINK_LIBRARIES(sample_config blackmisc ${QT_LIBRARIES})
|
||||
SET_TARGET_PROPERTIES(sample_config PROPERTIES PROJECT_LABEL "Samples - Config")
|
||||
0
blacklib/samples/config/config/config.ini
Normal file
0
blacklib/samples/config/config/config.ini
Normal file
3
blacklib/samples/config/config/position.cfg
Normal file
3
blacklib/samples/config/config/position.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
Longitude=48.999999
|
||||
Latitude=11.9999999
|
||||
Altitude=300
|
||||
2
blacklib/samples/config/config/test.cfg
Normal file
2
blacklib/samples/config/config/test.cfg
Normal file
@@ -0,0 +1,2 @@
|
||||
TestString = Hallo
|
||||
TestString2 = Welt
|
||||
27
blacklib/samples/config/main.cpp
Normal file
27
blacklib/samples/config/main.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <QCoreApplication>
|
||||
#include <blackmisc/debug.h>
|
||||
#include <blackmisc/config_manager.h>
|
||||
#include <blackmisc/config.h>
|
||||
#include <limits>
|
||||
#include <iostream>
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
BlackMisc::CApplicationContext myApplicationContext;
|
||||
|
||||
CConfigManager::getInstance().setConfigPath(QString("config"));
|
||||
if (!CConfigManager::getInstance().readConfig())
|
||||
{
|
||||
bWarning << "To run this sample, there must be a config folder";
|
||||
bWarning << "in the same directory, containing *.cfg files.";
|
||||
}
|
||||
|
||||
CConfig *myConfig = CConfigManager::getInstance().getConfig("position");
|
||||
bAssert(myConfig);
|
||||
myConfig->display();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user