Skip to content

Instantly share code, notes, and snippets.

@yossi-tahara yossi-tahara/CMakeLists.txt Secret
Last active Jun 6, 2017

Embed
What would you like to do?
Theolizer技術解説(2016/10/30) enum型を変更する
#[[###########################################################################
Theolizer紹介用サンプルCMakeLists.txt
]]############################################################################
if("${CMAKE_VERSION}" STREQUAL "")
set(CMAKE_VERSION, 3.5.0)
endif()
cmake_minimum_required(VERSION ${CMAKE_VERSION})
message(STATUS "BOOST_ROOT=${BOOST_ROOT}")
#-----------------------------------------------------------------------------
# プロジェクト設定
#-----------------------------------------------------------------------------
set(TARGET_NAME sample)
project(${TARGET_NAME} VERSION 1.0.0)
#-----------------------------------------------------------------------------
# ビルド設定
#-----------------------------------------------------------------------------
# MSVCの通常使わないビルド・モードとZERO_CHECKプロジェクトの削除
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
set(CMAKE_SUPPRESS_REGENERATION TRUE)
# Theolizer
find_package(THEOLIZER)
# Options
if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
add_definitions(-D_UNICODE -DUNICODE)
set(CMAKE_DEBUG_POSTFIX "d")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# MinGWの不具合(https://sourceforge.net/p/mingw-w64/discussion/723797/thread/c6b70624/#7f0a)暫定対処
if((CMAKE_COMPILER_IS_MINGW) AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj")
endif()
endif()
# ---<<< enum-rev.1 >>>---
set(ENUM1_LIST enum1.cpp enum1.h)
add_executable(enum1 ${ENUM1_LIST})
setup_theolizer(enum1 StaticWithBoost)
# ---<<< enum-rev.2 >>>---
set(ENUM2_LIST enum2.cpp enum2.h)
add_executable(enum2 ${ENUM2_LIST})
setup_theolizer(enum2 StaticWithBoost)
# ---<<< enum-rev.3 >>>---
set(ENUM3_LIST enum3.cpp enum3.h)
add_executable(enum3 ${ENUM3_LIST})
setup_theolizer(enum3 StaticWithBoost)
#-----------------------------------------------------------------------------
# テスト実行
#-----------------------------------------------------------------------------
enable_testing()
add_test(NAME Enum1Test COMMAND $<TARGET_FILE:enum1>)
add_test(NAME Enum2Test COMMAND $<TARGET_FILE:enum2>)
add_test(NAME Enum3Test COMMAND $<TARGET_FILE:enum3>)
set_tests_properties(Enum2Test PROPERTIES DEPENDS Enum1Test)
set_tests_properties(Enum3Test PROPERTIES DEPENDS Enum2Test)
add_custom_target(BuildTest COMMAND "ctest" "-V" "-C" $<CONFIG> -j2)
add_dependencies(BuildTest enum1)
add_dependencies(BuildTest enum2)
add_dependencies(BuildTest enum3)
//############################################################################
// Theolizer解説用サンプル・プログラムenum-rev.1
//############################################################################
#define THEOLIZER_GLOBAL_VERSION_TABLE
// ***************************************************************************
// インクルード
// ***************************************************************************
// 標準ライブラリ
#include <fstream>
// 共通定義
#include "enum1.h"
// Theolizer自動生成先
#include "enum1.cpp.theolizer.hpp"
// ***************************************************************************
// メイン
// ***************************************************************************
int main(int argc, char* argv[])
{
//----------------------------------------------------------------------------
// バラメータ解析
//----------------------------------------------------------------------------
std::string aLoadFile="";
if (1 < argc)
{
aLoadFile=argv[1];
}
std::cout << theolizer::print("aLoadFile=%s\n", aLoadFile);
//----------------------------------------------------------------------------
// 保存
//----------------------------------------------------------------------------
if (aLoadFile.empty())
{
aLoadFile="test1.json";
// データを生成する
WeekDay aWeekDayA=ewdWeekDay1;
WeekDay aWeekDayB=ewdWeekDay2;
Color aColorA=ecColor1;
Color aColorB=ecColor2;
// 保存先のファイルをオープンする
std::ofstream aStream(aLoadFile);
// シリアライザを用意する
theolizer::JsonOSerializer<> js(aStream);
// test.jsonファイルへ保存する
THEOLIZER_PROCESS(js, aWeekDayA);
THEOLIZER_PROCESS(js, aWeekDayB);
THEOLIZER_PROCESS(js, aColorA);
THEOLIZER_PROCESS(js, aColorB);
}
//----------------------------------------------------------------------------
// 回復
//----------------------------------------------------------------------------
// 回復処理
{
// データ領域を獲得する
WeekDay aWeekDayA=ewdWeekDay0;
WeekDay aWeekDayB=ewdWeekDay0;
Color aColorA=ecColor0;
Color aColorB=ecColor0;
// 回復元のファイルをオープンする
std::ifstream aStream(aLoadFile);
// シリアライザを用意する
theolizer::JsonISerializer<> js(aStream, true);
// test.jsonファイルから回復する
THEOLIZER_PROCESS(js, aWeekDayA);
THEOLIZER_PROCESS(js, aWeekDayB);
THEOLIZER_PROCESS(js, aColorA);
THEOLIZER_PROCESS(js, aColorB);
// エラー・チェック(例外を禁止している場合に必要)
theolizer::ErrorInfo aErrorInfo = js.getErrorInfo();
if (aErrorInfo)
{
std::cout << aErrorInfo.getMessage() << std::endl;
js.resetError(); // チェックしたことを通知する
return 1;
}
// 回復結果を表示する
std::cout << "WeekDay ...\n" <<
theolizer::print(u8" aWeekDayA=%d(%d=ewdWeekDay1)\n", aWeekDayA, ewdWeekDay1);
std::cout <<
theolizer::print(u8" aWeekDayB=%d(%d=ewdWeekDay2)\n", aWeekDayB, ewdWeekDay2);
std::cout << "\nColor ...\n" <<
theolizer::print(u8" aColorA=%d(%d=ecColor1)\n", aColorA, ecColor1);
std::cout <<
theolizer::print(u8" aColorB=%d(%d=ecColor2)\n", aColorA, ecColor2);
}
return 0;
}
#ifdef THEOLIZER_WRITE_CODE // ###### WeekDay ######
#define THEOLIZER_GENERATED_LAST_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kLastVersionNo,1)
#define THEOLIZER_GENERATED_FULL_AUTO WeekDay
// ---<<< Version.1 >>>---
#define THEOLIZER_GENERATED_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kVersionNo,1)
#define THEOLIZER_GENERATED_ENUM_NAME u8"WeekDay"
#define THEOLIZER_GENERATED_SAVE_TYPE estName
#define THEOLIZER_GENERATED_BASE_TYPE int
#define THEOLIZER_GENERATED_ENUM_LIST()\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay0"),(0),(0))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay1"),(1),(1))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay2"),(2),(2))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay3"),(3),(3))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay4"),(4),(4))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay5"),(5),(5))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay6"),(6),(6))
#define THEOLIZER_GENERATED_DEFAULT_VALUE 0
#include <theolizer/internal/version_enum.inc>
#undef THEOLIZER_GENERATED_VERSION_NO
#endif//THEOLIZER_WRITE_CODE // ###### WeekDay ######
#ifdef THEOLIZER_WRITE_CODE // ###### Color ######
#define THEOLIZER_GENERATED_LAST_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kLastVersionNo,1)
#define THEOLIZER_GENERATED_ENUM_TYPE Color
// ---<<< Version.1 >>>---
#define THEOLIZER_GENERATED_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kVersionNo,1)
#define THEOLIZER_GENERATED_ENUM_NAME u8"Color"
#define THEOLIZER_GENERATED_SAVE_TYPE estValue
#define THEOLIZER_GENERATED_BASE_TYPE int
#define THEOLIZER_GENERATED_ENUM_LIST()\
THEOLIZER_GENERATED_ELEMENT((u8"ecColor0"),(0),(0))\
THEOLIZER_GENERATED_ELEMENT((u8"ecColor1"),(1),(1))\
THEOLIZER_GENERATED_ELEMENT((u8"ecColor2"),(2),(2))
#define THEOLIZER_GENERATED_DEFAULT_VALUE 0
#include <theolizer/internal/version_enum.inc>
#undef THEOLIZER_GENERATED_VERSION_NO
#endif//THEOLIZER_WRITE_CODE // ###### Color ######
#ifdef THEOLIZER_WRITE_CODE // ###### Global VersionNo. Table ######
THEOLIZER_GENERATED_GLOBAL_TABLE();
#endif//THEOLIZER_WRITE_CODE // ###### Global VersionNo. Table ######
//############################################################################
// Theolizer解説用サンプル・プログラムenum-rev.1
//############################################################################
#if !defined(MAIN_H)
#define MAIN_H
// ***************************************************************************
// インクルード
// ***************************************************************************
// 標準ライブラリ
#include <string>
// Theolizerライブラリ
#include <theolizer/serializer_json.h>
// ***************************************************************************
// サンプルenum型定義
// ***************************************************************************
// 名前保存
enum WeekDay
{
ewdWeekDay0,
ewdWeekDay1,
ewdWeekDay2,
ewdWeekDay3,
ewdWeekDay4,
ewdWeekDay5,
ewdWeekDay6,
};
// 値保存
enum Color
{
ecColor0,
ecColor1,
ecColor2
};
THEOLIZER_ENUM_VALUE(Color, 1);
#endif
aLoadFile=
WeekDay ...
aWeekDayA=1(1=ewdWeekDay1)
aWeekDayB=2(2=ewdWeekDay2)
Color ...
aColorA=1(1=ecColor1)
aColorB=1(2=ecColor2)
aLoadFile=test1.json
WeekDay ...
aWeekDayA=101(101=ewdWeekDay1)
aWeekDayB=102(102=ewdWeekDay2)
Color ...
aColorA=1(1=ecActiveCaption)
aColorB=1(2=ecAppWorkspace)
aLoadFile=test1.json
WeekDay ...
aWeekDayA=101(101=ewdMonday)
aWeekDayB=102(102=ewdTuesday)
Color ...
aColorA=0x10000001(0x10000001=ecActiveCaption)
aColorB=0x10000001(0x10000002=ecAppWorkspace)
//############################################################################
// Theolizer解説用サンプル・プログラムenum-rev.2
//############################################################################
#define THEOLIZER_GLOBAL_VERSION_TABLE
// ***************************************************************************
// インクルード
// ***************************************************************************
// 標準ライブラリ
#include <fstream>
// 共通定義
#include "enum2.h"
// Theolizer自動生成先
#include "enum2.cpp.theolizer.hpp"
// ***************************************************************************
// メイン
// ***************************************************************************
int main(int argc, char* argv[])
{
//----------------------------------------------------------------------------
// バラメータ解析
//----------------------------------------------------------------------------
std::string aLoadFile="test1.json";
if (1 < argc)
{
aLoadFile=argv[1];
}
std::cout << theolizer::print("aLoadFile=%s\n", aLoadFile);
//----------------------------------------------------------------------------
// 回復
//----------------------------------------------------------------------------
// 回復処理
{
// データ領域を獲得する
WeekDay aWeekDayA=ewdWeekDay0;
WeekDay aWeekDayB=ewdWeekDay0;
Color aColorA=ecActiveBorder;
Color aColorB=ecActiveBorder;
// 回復元のファイルをオープンする
std::ifstream aStream(aLoadFile);
// シリアライザを用意する
theolizer::JsonISerializer<> js(aStream, true);
// aColorをtest.jsonファイルから回復する
THEOLIZER_PROCESS(js, aWeekDayA);
THEOLIZER_PROCESS(js, aWeekDayB);
THEOLIZER_PROCESS(js, aColorA);
THEOLIZER_PROCESS(js, aColorB);
// エラー・チェック(例外を禁止している場合に必要)
theolizer::ErrorInfo aErrorInfo = js.getErrorInfo();
if (aErrorInfo)
{
std::cout << aErrorInfo.getMessage() << std::endl;
js.resetError(); // チェックしたことを通知する
return 1;
}
// 回復結果を表示する
std::cout << "WeekDay ...\n" <<
theolizer::print(u8" aWeekDayA=%d(%d=ewdWeekDay1)\n", aWeekDayA, ewdWeekDay1);
std::cout <<
theolizer::print(u8" aWeekDayB=%d(%d=ewdWeekDay2)\n", aWeekDayB, ewdWeekDay2);
std::cout << "\nColor ...\n" <<
theolizer::print(u8" aColorA=%d(%d=ecActiveCaption)\n", aColorA, ecActiveCaption);
std::cout <<
theolizer::print(u8" aColorB=%d(%d=ecAppWorkspace)\n", aColorA, ecAppWorkspace);
// 自分のフォーマットで保存する
{
// 保存先のファイルをオープンする
std::ofstream aStream("test2.json");
// シリアライザを用意する
theolizer::JsonOSerializer<> js(aStream);
// test.jsonファイルへ保存する
THEOLIZER_PROCESS(js, aWeekDayA);
THEOLIZER_PROCESS(js, aWeekDayB);
THEOLIZER_PROCESS(js, aColorA);
THEOLIZER_PROCESS(js, aColorB);
}
}
return 0;
}
#ifdef THEOLIZER_WRITE_CODE // ###### WeekDay ######
#define THEOLIZER_GENERATED_LAST_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kLastVersionNo,1)
#define THEOLIZER_GENERATED_FULL_AUTO WeekDay
// ---<<< Version.1 >>>---
#define THEOLIZER_GENERATED_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kVersionNo,1)
#define THEOLIZER_GENERATED_ENUM_NAME u8"WeekDay"
#define THEOLIZER_GENERATED_SAVE_TYPE estName
#define THEOLIZER_GENERATED_BASE_TYPE int
#define THEOLIZER_GENERATED_ENUM_LIST()\
THEOLIZER_GENERATED_ELEMENT((u8"ewdUnknown"),(0),(0))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay0"),(100),(100))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay1"),(101),(101))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay2"),(102),(102))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay3"),(103),(103))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay4"),(104),(104))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay5"),(105),(105))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWeekDay6"),(106),(106))
#define THEOLIZER_GENERATED_DEFAULT_VALUE 0
#include <theolizer/internal/version_enum.inc>
#undef THEOLIZER_GENERATED_VERSION_NO
#endif//THEOLIZER_WRITE_CODE // ###### WeekDay ######
#ifdef THEOLIZER_WRITE_CODE // ###### Color ######
#define THEOLIZER_GENERATED_LAST_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kLastVersionNo,1)
#define THEOLIZER_GENERATED_ENUM_TYPE Color
// ---<<< Version.1 >>>---
#define THEOLIZER_GENERATED_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kVersionNo,1)
#define THEOLIZER_GENERATED_ENUM_NAME u8"Color"
#define THEOLIZER_GENERATED_SAVE_TYPE estValue
#define THEOLIZER_GENERATED_BASE_TYPE int
#define THEOLIZER_GENERATED_ENUM_LIST()\
THEOLIZER_GENERATED_ELEMENT((u8"ecActiveBorder"),(0),(0))\
THEOLIZER_GENERATED_ELEMENT((u8"ecActiveCaption"),(1),(1))\
THEOLIZER_GENERATED_ELEMENT((u8"ecAppWorkspace"),(2),(2))
#define THEOLIZER_GENERATED_DEFAULT_VALUE 0
#include <theolizer/internal/version_enum.inc>
#undef THEOLIZER_GENERATED_VERSION_NO
#endif//THEOLIZER_WRITE_CODE // ###### Color ######
#ifdef THEOLIZER_WRITE_CODE // ###### Global VersionNo. Table ######
THEOLIZER_GENERATED_GLOBAL_TABLE();
#endif//THEOLIZER_WRITE_CODE // ###### Global VersionNo. Table ######
//############################################################################
// Theolizer解説用サンプル・プログラムenum-rev.2
//############################################################################
#if !defined(MAIN_H)
#define MAIN_H
// ***************************************************************************
// インクルード
// ***************************************************************************
// 標準ライブラリ
#include <string>
// Theolizerライブラリ
#include <theolizer/serializer_json.h>
// ***************************************************************************
// サンプルenum型定義
// シンボル名保存は値を変更
// 値保存はシンボル名を変更
// ***************************************************************************
enum WeekDay
{
ewdUnknown,
ewdWeekDay0=100,
ewdWeekDay1,
ewdWeekDay2,
ewdWeekDay3,
ewdWeekDay4,
ewdWeekDay5,
ewdWeekDay6
};
// 値保存
enum Color
{
ecActiveBorder,
ecActiveCaption,
ecAppWorkspace
};
THEOLIZER_ENUM_VALUE(Color, 1);
#endif
//############################################################################
// Theolizer解説用サンプル・プログラムenum-rev.3
//############################################################################
#define THEOLIZER_GLOBAL_VERSION_TABLE
// ***************************************************************************
// インクルード
// ***************************************************************************
// 標準ライブラリ
#include <fstream>
// 共通定義
#include "enum3.h"
// Theolizer自動生成先
#include "enum3.cpp.theolizer.hpp"
// ***************************************************************************
// メイン
// ***************************************************************************
int main(int argc, char* argv[])
{
//----------------------------------------------------------------------------
// バラメータ解析
//----------------------------------------------------------------------------
std::string aLoadFile="test1.json";
if (1 < argc)
{
aLoadFile=argv[1];
}
std::cout << theolizer::print("aLoadFile=%s\n", aLoadFile);
//----------------------------------------------------------------------------
// 回復
//----------------------------------------------------------------------------
// 回復処理
{
// データ領域を獲得する
WeekDay aWeekDayA=ewdUnknown;
WeekDay aWeekDayB=ewdUnknown;
Color aColorA=ecDefault;
Color aColorB=ecDefault;
// 回復元のファイルをオープンする
std::ifstream aStream(aLoadFile);
// シリアライザを用意する
theolizer::JsonISerializer<> js(aStream, true);
// aColorをtest.jsonファイルから回復する
THEOLIZER_PROCESS(js, aWeekDayA);
THEOLIZER_PROCESS(js, aWeekDayB);
THEOLIZER_PROCESS(js, aColorA);
THEOLIZER_PROCESS(js, aColorB);
// エラー・チェック(例外を禁止している場合に必要)
theolizer::ErrorInfo aErrorInfo = js.getErrorInfo();
if (aErrorInfo)
{
std::cout << aErrorInfo.getMessage() << std::endl;
js.resetError(); // チェックしたことを通知する
return 1;
}
// 回復結果を表示する
std::cout << "WeekDay ...\n" <<
theolizer::print(u8" aWeekDayA=%d(%d=ewdMonday)\n", aWeekDayA, ewdMonday);
std::cout <<
theolizer::print(u8" aWeekDayB=%d(%d=ewdTuesday)\n", aWeekDayB, ewdTuesday);
std::cout << "\nColor ...\n" <<
theolizer::print(u8" aColorA=0x%x(0x%x=ecActiveCaption)\n", aColorA, ecActiveCaption);
std::cout <<
theolizer::print(u8" aColorB=0x%x(0x%x=ecAppWorkspace)\n", aColorA, ecAppWorkspace);
// 自分のフォーマットで保存する
{
// 保存先のファイルをオープンする
std::ofstream aStream("test3.json");
// シリアライザを用意する
theolizer::JsonOSerializer<> js(aStream);
// test.jsonファイルへ保存する
THEOLIZER_PROCESS(js, aWeekDayA);
THEOLIZER_PROCESS(js, aWeekDayB);
THEOLIZER_PROCESS(js, aColorA);
THEOLIZER_PROCESS(js, aColorB);
}
}
return 0;
}
#ifdef THEOLIZER_WRITE_CODE // ###### WeekDay ######
#define THEOLIZER_GENERATED_LAST_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kLastVersionNo,1)
#define THEOLIZER_GENERATED_FULL_AUTO WeekDay
// ---<<< Version.1 >>>---
#define THEOLIZER_GENERATED_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kVersionNo,1)
#define THEOLIZER_GENERATED_ENUM_NAME u8"WeekDay"
#define THEOLIZER_GENERATED_SAVE_TYPE estName
#define THEOLIZER_GENERATED_BASE_TYPE int
#define THEOLIZER_GENERATED_ENUM_LIST()\
THEOLIZER_GENERATED_ELEMENT((u8"ewdUnknown"),(0),(0))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdSunday",u8"ewdWeekDay0"),(100),(100))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdMonday",u8"ewdWeekDay1"),(101),(101))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdTuesday",u8"ewdWeekDay2"),(102),(102))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdWednesday",u8"ewdWeekDay3"),(103),(103))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdThursday",u8"ewdWeekDay4"),(104),(104))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdFriday",u8"ewdWeekDay5"),(105),(105))\
THEOLIZER_GENERATED_ELEMENT((u8"ewdSaturday",u8"ewdWeekDay6"),(106),(106))
#define THEOLIZER_GENERATED_DEFAULT_VALUE 0
#include <theolizer/internal/version_enum.inc>
#undef THEOLIZER_GENERATED_VERSION_NO
#endif//THEOLIZER_WRITE_CODE // ###### WeekDay ######
#ifdef THEOLIZER_WRITE_CODE // ###### Color ######
#define THEOLIZER_GENERATED_LAST_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kLastVersionNo,1)
#define THEOLIZER_GENERATED_ENUM_TYPE Color
// ---<<< Version.1 >>>---
#define THEOLIZER_GENERATED_VERSION_NO THEOLIZER_INTERNAL_DEFINE(kVersionNo,1)
#define THEOLIZER_GENERATED_ENUM_NAME u8"Color"
#define THEOLIZER_GENERATED_SAVE_TYPE estValue
#define THEOLIZER_GENERATED_BASE_TYPE int
#define THEOLIZER_GENERATED_ENUM_LIST()\
THEOLIZER_GENERATED_ELEMENT((u8"ecDefault"),(0),(0))\
THEOLIZER_GENERATED_ELEMENT((u8"ecBlack"),(0),(0))\
THEOLIZER_GENERATED_ELEMENT((u8"ecWhite"),(16777215),(16777215))\
THEOLIZER_GENERATED_ELEMENT((u8"ecRed"),(16711680),(16711680))\
THEOLIZER_GENERATED_ELEMENT((u8"ecGreen"),(65280),(65280))\
THEOLIZER_GENERATED_ELEMENT((u8"ecBlue"),(255),(255))\
THEOLIZER_GENERATED_ELEMENT((u8"ecActiveBorder"),(268435456,0),(268435456))\
THEOLIZER_GENERATED_ELEMENT((u8"ecActiveCaption"),(268435457,1),(268435457))\
THEOLIZER_GENERATED_ELEMENT((u8"ecAppWorkspace"),(268435458,2),(268435458))
#define THEOLIZER_GENERATED_DEFAULT_VALUE 0
#include <theolizer/internal/version_enum.inc>
#undef THEOLIZER_GENERATED_VERSION_NO
#endif//THEOLIZER_WRITE_CODE // ###### Color ######
#ifdef THEOLIZER_WRITE_CODE // ###### Global VersionNo. Table ######
THEOLIZER_GENERATED_GLOBAL_TABLE();
#endif//THEOLIZER_WRITE_CODE // ###### Global VersionNo. Table ######
//############################################################################
// Theolizer解説用サンプル・プログラムenum-rev.3
//############################################################################
#if !defined(MAIN_H)
#define MAIN_H
// ***************************************************************************
// インクルード
// ***************************************************************************
// 標準ライブラリ
#include <string>
// Theolizerライブラリ
#include <theolizer/serializer_json.h>
// ***************************************************************************
// サンプルenum型定義
// どちらとも、シンボル名と値の両方を変更
// ***************************************************************************
enum WeekDay
{
ewdUnknown,
ewdSunday THEOLIZER_ANNOTATE(ES:ewdWeekDay0)=100,
ewdMonday THEOLIZER_ANNOTATE(ES:ewdWeekDay1),
ewdTuesday THEOLIZER_ANNOTATE(ES:ewdWeekDay2),
ewdWednesday THEOLIZER_ANNOTATE(ES:ewdWeekDay3),
ewdThursday THEOLIZER_ANNOTATE(ES:ewdWeekDay4),
ewdFriday THEOLIZER_ANNOTATE(ES:ewdWeekDay5),
ewdSaturday THEOLIZER_ANNOTATE(ES:ewdWeekDay6)
};
// 値保存
enum Color
{
ecDefault =0x00000000,
ecBlack =0x00000000,
ecWhite =0x00ffffff,
ecRed =0x00ff0000,
ecGreen =0x0000ff00,
ecBlue =0x000000ff,
ecActiveBorder THEOLIZER_ANNOTATE(ES::0) =0x10000000,
ecActiveCaption THEOLIZER_ANNOTATE(ES::1),
ecAppWorkspace THEOLIZER_ANNOTATE(ES::2)
};
THEOLIZER_ENUM_VALUE(Color, 1);
#endif
aLoadFile=test3.json
Can not find loaded value(0) in Version.1's symbol. Please check THEOLIZER_ANNOTATE() for Color.
aLoadFile=test3.json
WeekDay ...
aWeekDayA=101(101=ewdMonday)
aWeekDayB=102(102=ewdTuesday)
Color ...
aColorA=0x10000001(0x10000001=ecActiveCaption)
aColorB=0x10000001(0x10000002=ecAppWorkspace)
{
"SerialzierName":"JsonTheolizer",
"GlobalVersionNo":1,
"TypeInfoList":[1]
}
"ewdWeekDay1"
"ewdWeekDay2"
1
2
{
"SerialzierName":"JsonTheolizer",
"GlobalVersionNo":1,
"TypeInfoList":[1]
}
"ewdMonday"
"ewdTuesday"
268435457
268435458
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.