Skip to content

Commit

Permalink
Add InnFile.
Browse files Browse the repository at this point in the history
  • Loading branch information
fonwin committed Jun 28, 2018
1 parent f834330 commit 6cd29ca
Show file tree
Hide file tree
Showing 12 changed files with 1,052 additions and 4 deletions.
10 changes: 9 additions & 1 deletion Overview/Filing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 14,13 @@
## Serialize/Deserialize

## InnFile
* [`fon9/InnFile.hpp`](../fon9/InnFile.hpp)
* 著重功能:
* 房間的建立、取得。
* 讀取房間內容。
* 寫入房間內容。
* 進階功能:由 InnDbf 提供。

## 資料同步機制
## InnDbf
### 資料表的連結
### 資料同步機制
1 change: 1 addition & 0 deletions build/cmake/unit_test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 45,7 @@ $OUTPUT_DIR/MemBlock_UT
# unit tests: file
$OUTPUT_DIR/File_UT
$OUTPUT_DIR/TimedFileName_UT
$OUTPUT_DIR/InnFile_UT

rm -rf ./logs
rm -rf /tmp/*log
Expand Down
85 changes: 85 additions & 0 deletions build/vs2015/_UnitTests/InnFile_UT.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F46375FE-1536-4DB4-8D69-2B137A639A09}</ProjectGuid>
<RootNamespace>InnFile_UT</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\..\..\output\$(SolutionName)\$(PlatformArchitecture)\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\..\..\output\$(SolutionName)\$(PlatformArchitecture)\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\..\..\fon9</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\..\..\fon9</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\fon9\InnFile_UT.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\libfon9\libfon9.vcxproj">
<Project>{6b9031a7-02e1-4171-8ca5-9f780be21806}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
22 changes: 22 additions & 0 deletions build/vs2015/_UnitTests/InnFile_UT.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\fon9\InnFile_UT.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
9 changes: 8 additions & 1 deletion build/vs2015/fon9.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 35,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools_Utility", "Tools_Util
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MemBlock_UT", "_UnitTests\MemBlock_UT.vcxproj", "{5D83E5F6-E5A8-4AEC-84AF-F34DD582B586}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "File", "File", "{CB1CFD79-6CAD-4A0F-8CE1-A59F434B5A84}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "File_Inn", "File_Inn", "{CB1CFD79-6CAD-4A0F-8CE1-A59F434B5A84}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "File_UT", "_UnitTests\File_UT.vcxproj", "{E7F7AAA0-BAB0-45CC-A51C-888667CC8FF2}"
EndProject
Expand Down Expand Up @@ -69,6 69,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Container_Algorithm", "Cont
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tree_UT", "_UnitTests\Tree_UT.vcxproj", "{C2283F31-2244-4DEB-8C13-CA1FF484FDDB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InnFile_UT", "_UnitTests\InnFile_UT.vcxproj", "{F46375FE-1536-4DB4-8D69-2B137A639A09}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -171,6 173,10 @@ Global
{C2283F31-2244-4DEB-8C13-CA1FF484FDDB}.Debug|x64.Build.0 = Debug|x64
{C2283F31-2244-4DEB-8C13-CA1FF484FDDB}.Release|x64.ActiveCfg = Release|x64
{C2283F31-2244-4DEB-8C13-CA1FF484FDDB}.Release|x64.Build.0 = Release|x64
{F46375FE-1536-4DB4-8D69-2B137A639A09}.Debug|x64.ActiveCfg = Debug|x64
{F46375FE-1536-4DB4-8D69-2B137A639A09}.Debug|x64.Build.0 = Debug|x64
{F46375FE-1536-4DB4-8D69-2B137A639A09}.Release|x64.ActiveCfg = Release|x64
{F46375FE-1536-4DB4-8D69-2B137A639A09}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -206,5 212,6 @@ Global
{3F6A3F48-F258-40BC-A170-DF0CD150A212} = {993AE6E8-08E5-4943-BC92-592A81211FF0}
{84EDB5C7-36C8-4EC9-9A66-9B83356A908B} = {6B161511-B07B-4921-8404-EE71775CE5DC}
{C2283F31-2244-4DEB-8C13-CA1FF484FDDB} = {51700D09-381E-46C8-8511-801626F39F1F}
{F46375FE-1536-4DB4-8D69-2B137A639A09} = {CB1CFD79-6CAD-4A0F-8CE1-A59F434B5A84}
EndGlobalSection
EndGlobal
2 changes: 2 additions & 0 deletions build/vs2015/libfon9/libfon9.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 100,7 @@
<ClInclude Include="..\..\..\fon9\File.hpp" />
<ClInclude Include="..\..\..\fon9\FileAppender.hpp" />
<ClInclude Include="..\..\..\fon9\FilePath.hpp" />
<ClInclude Include="..\..\..\fon9\InnFile.hpp" />
<ClInclude Include="..\..\..\fon9\io\Device.hpp" />
<ClInclude Include="..\..\..\fon9\io\DeviceAsyncOp.hpp" />
<ClInclude Include="..\..\..\fon9\io\FdrService.hpp" />
Expand Down Expand Up @@ -227,6 228,7 @@
<ClCompile Include="..\..\..\fon9\File.cpp" />
<ClCompile Include="..\..\..\fon9\FileAppender.cpp" />
<ClCompile Include="..\..\..\fon9\FilePath.cpp" />
<ClCompile Include="..\..\..\fon9\InnFile.cpp" />
<ClCompile Include="..\..\..\fon9\io\Device.cpp" />
<ClCompile Include="..\..\..\fon9\io\FdrService.cpp" />
<ClCompile Include="..\..\..\fon9\io\FdrServiceEpoll.cpp" />
Expand Down
12 changes: 12 additions & 0 deletions build/vs2015/libfon9/libfon9.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 102,12 @@
<Filter Include="Header Files\seed\_fields">
<UniqueIdentifier>{96dc55c5-7be5-443c-92a2-1b2de4a7a509}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\_base\_Inn">
<UniqueIdentifier>{2f1ce5cc-8750-497b-b8bf-c40d8a72df75}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\_base\_Inn">
<UniqueIdentifier>{09f01b7f-354b-4472-b568-469b30a64644}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\fon9\sys\Config.h">
Expand Down Expand Up @@ -482,6 488,9 @@
<ClInclude Include="..\..\..\fon9\LevelArray.hpp">
<Filter>Header Files\_base\_Container / Algorithm</Filter>
</ClInclude>
<ClInclude Include="..\..\..\fon9\InnFile.hpp">
<Filter>Header Files\_base\_Inn</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\README.md" />
Expand Down Expand Up @@ -718,5 727,8 @@
<ClCompile Include="..\..\..\fon9\seed\PodOp.cpp">
<Filter>Source Files\seed\_base</Filter>
</ClCompile>
<ClCompile Include="..\..\..\fon9\InnFile.cpp">
<Filter>Source Files\_base\_Inn</Filter>
</ClCompile>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions fon9/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 29,7 @@ set(fon9src
FileAppender.cpp
LogFile.cpp
FdrNotify.cpp
InnFile.cpp

buffer/MemBlock.cpp
buffer/BufferNode.cpp
Expand Down Expand Up @@ -145,6 146,9 @@ target_link_libraries(TimedFileName_UT fon9_s)
add_executable(LogFile_UT LogFile_UT.cpp)
target_link_libraries(LogFile_UT fon9_s)

add_executable(InnFile_UT InnFile_UT.cpp)
target_link_libraries(InnFile_UT fon9_s)

# unit tests: io
add_executable(Socket_UT io/Socket_UT.cpp)
target_link_libraries(Socket_UT fon9_s)
Expand Down
4 changes: 2 additions & 2 deletions fon9/Exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 12,7 @@ namespace fon9 {
/// 透過一層間接呼叫, 可讓 compiler 更容易最佳化: 會丟出異常的 function.
template <class E, class... ArgsT>
[[noreturn]] void Raise(ArgsT&&... args) {
throw E{std::forward<ArgsT>(args)...};
throw E(std::forward<ArgsT>(args)...);
}
/// \ingroup Misc
/// 丟出異常.
Expand All @@ -21,7 21,7 @@ template <class E, class... ArgsT>
/// - 這在 constexpr function 裡面很常用到。
template <class ReturnT, class E, class... ArgsT>
[[noreturn]] ReturnT Raise(ArgsT&&... args) {
throw E{std::forward<ArgsT>(args)...};
throw E(std::forward<ArgsT>(args)...);
}

fon9_MSC_WARN_DISABLE(4623); // 4623: 'fon9::BufferOverflow': default constructor was implicitly defined as deleted
Expand Down
Loading

0 comments on commit 6cd29ca

Please sign in to comment.