CMakified project

This commit is contained in:
2016-11-09 19:01:48 +01:00
parent b72ec8e1dd
commit fe19a81484
26 changed files with 256 additions and 1285 deletions
+1 -252
View File
@@ -1,252 +1 @@
## Ignore Visual Studio temporary files, build results, and build/
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
+13
View File
@@ -0,0 +1,13 @@
# Nowide_FOUND
# Nowide_INCLUDE_DIRS
find_path(Nowide_INCLUDE_DIR boost/nowide/convert.hpp
/usr/local/include
/usr/include
)
set(Nowide_INCLUDE_DIR ${Nowide_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Nowide DEFAULT_MSG Nowide_INCLUDE_DIR)
mark_as_advanced(Nowide_FOUND Nowide_INCLUDE_DIR)
+13
View File
@@ -0,0 +1,13 @@
# TCLAP_FOUND
# TCLAP_INCLUDE_DIRS
find_path(TCLAP_INCLUDE_DIR tclap/CmdLine.h
/usr/local/include
/usr/include
)
set(TCLAP_INCLUDE_DIRS ${TCLAP_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TCLAP DEFAULT_MSG TCLAP_INCLUDE_DIR)
mark_as_advanced(TCLAP_FOUND TCLAP_INCLUDE_DIR)
+43
View File
@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.6)
project(RebootInto)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "${PROJECT_SOURCE_DIR}/deps/include")
if(MINGW)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/deps/lib/mingw/x64")
elseif(MSVC)
if(CMAKE_GENERATOR MATCHES "x64")
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/deps/lib/msvc14/x64")
else()
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/deps/lib/msvc14/x86")
endif()
else()
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/deps/lib/linux-gcc/x64")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
elseif(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
# DEBUG definition
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
$<$<CONFIG:Debug>:DEBUG>
$<$<CONFIG:RelWithDebInfo>:DEBUG>
)
include_directories(${PROJECT_SOURCE_DIR}/src)
add_subdirectory(src)
-28
View File
@@ -1,28 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RebootInto", "RebootInto\RebootInto.vcxproj", "{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Debug|x64.ActiveCfg = Debug|x64
{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Debug|x64.Build.0 = Debug|x64
{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Debug|x86.ActiveCfg = Debug|Win32
{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Debug|x86.Build.0 = Debug|Win32
{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Release|x64.ActiveCfg = Release|x64
{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Release|x64.Build.0 = Release|x64
{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Release|x86.ActiveCfg = Release|Win32
{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
-152
View File
@@ -1,152 +0,0 @@
<?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|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<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>{99BB47F2-FC67-43E8-BDDB-CFF4C426D365}</ProjectGuid>
<RootNamespace>RebootInto</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<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|Win32'">
<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)'=='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|Win32'">
<IncludePath>$(SolutionDir)/deps/include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>$(SolutionDir)/deps/lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)/deps/include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>$(SolutionDir)/deps/lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LibraryPath>$(SolutionDir)/deps/lib;$(LibraryPath)</LibraryPath>
<IncludePath>$(SolutionDir)/deps/include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LibraryPath>$(SolutionDir)/deps/lib;$(LibraryPath)</LibraryPath>
<IncludePath>$(SolutionDir)/deps/include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>false</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>false</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>false</OmitFramePointers>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
</Project>
@@ -5,19 +5,19 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_ARGS_HPP_INCLUDED #ifndef BOOST_NOWIDE_ARGS_HPP_INCLUDED
#define NOWIDE_ARGS_HPP_INCLUDED #define BOOST_NOWIDE_ARGS_HPP_INCLUDED
#include <nowide/config.hpp> #include <boost/config.hpp>
#include <nowide/stackstring.hpp> #include <boost/nowide/stackstring.hpp>
#include <vector> #include <vector>
#ifdef NOWIDE_WINDOWS #ifdef BOOST_WINDOWS
#include <nowide/windows.hpp> #include <boost/nowide/windows.hpp>
#endif #endif
namespace boost {
namespace nowide { namespace nowide {
#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_DOXYGEN) #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN)
class args { class args {
public: public:
args(int &,char **&) {} args(int &,char **&) {}
@@ -160,7 +160,7 @@ namespace nowide {
#endif #endif
} // nowide } // nowide
} // namespace boost
#endif #endif
/// ///
@@ -5,23 +5,23 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_CENV_H_INCLUDED #ifndef BOOST_NOWIDE_CENV_H_INCLUDED
#define NOWIDE_CENV_H_INCLUDED #define BOOST_NOWIDE_CENV_H_INCLUDED
#include <string> #include <string>
#include <stdexcept> #include <stdexcept>
#include <stdlib.h> #include <stdlib.h>
#include <nowide/config.hpp> #include <boost/config.hpp>
#include <nowide/stackstring.hpp> #include <boost/nowide/stackstring.hpp>
#include <vector> #include <vector>
#ifdef NOWIDE_WINDOWS #ifdef BOOST_WINDOWS
#include <nowide/windows.hpp> #include <boost/nowide/windows.hpp>
#endif #endif
namespace boost {
namespace nowide { namespace nowide {
#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_DOXYGEN) #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN)
using ::getenv; using ::getenv;
using ::setenv; using ::setenv;
using ::unsetenv; using ::unsetenv;
@@ -119,7 +119,7 @@ namespace nowide {
} }
#endif #endif
} // nowide } // nowide
} // namespace boost
#endif #endif
/// ///
+54
View File
@@ -0,0 +1,54 @@
//
// Copyright (c) 2012 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NOWIDE_CONFIG_HPP_INCLUDED
#define BOOST_NOWIDE_CONFIG_HPP_INCLUDED
#include <boost/config.hpp>
#ifndef BOOST_SYMBOL_VISIBLE
# define BOOST_SYMBOL_VISIBLE
#endif
#ifdef BOOST_HAS_DECLSPEC
# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
# ifdef BOOST_NOWIDE_SOURCE
# define BOOST_NOWIDE_DECL BOOST_SYMBOL_EXPORT
# else
# define BOOST_NOWIDE_DECL BOOST_SYMBOL_IMPORT
# endif // BOOST_NOWIDE_SOURCE
# endif // DYN_LINK
#endif // BOOST_HAS_DECLSPEC
#ifndef BOOST_NOWIDE_DECL
# define BOOST_NOWIDE_DECL
#endif
//
// Automatically link to the correct build variant where possible.
//
#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_NOWIDE_NO_LIB) && !defined(BOOST_NOWIDE_SOURCE)
//
// Set the name of our library, this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define BOOST_LIB_NAME boost_nowide
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
# define BOOST_DYN_LINK
#endif
//
// And include the header that does the work:
//
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
#endif // boost/nowide/config.hpp
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
@@ -5,13 +5,13 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_CONVERT_H_INCLUDED #ifndef BOOST_NOWIDE_CONVERT_H_INCLUDED
#define NOWIDE_CONVERT_H_INCLUDED #define BOOST_NOWIDE_CONVERT_H_INCLUDED
#include <string> #include <string>
#include <nowide/encoding_utf.hpp> #include <boost/locale/encoding_utf.hpp>
namespace boost {
namespace nowide { namespace nowide {
/// ///
/// \brief Template function that converts a buffer of UTF sequence in range [source_begin,source_end) /// \brief Template function that converts a buffer of UTF sequence in range [source_begin,source_end)
@@ -30,7 +30,7 @@ namespace nowide {
return 0; return 0;
buffer_size --; buffer_size --;
while(source_begin!=source_end) { while(source_begin!=source_end) {
using namespace nowide::utf; using namespace boost::locale::utf;
code_point c = utf_traits<CharIn>::template decode<CharIn const *>(source_begin,source_end); code_point c = utf_traits<CharIn>::template decode<CharIn const *>(source_begin,source_end);
if(c==illegal || c==incomplete) { if(c==illegal || c==incomplete) {
rv = 0; rv = 0;
@@ -112,42 +112,42 @@ namespace nowide {
/// ///
/// Convert between Wide - UTF-16/32 string and UTF-8 string. /// Convert between Wide - UTF-16/32 string and UTF-8 string.
/// ///
/// nowide::conv::conversion_error is thrown in a case of a error /// boost::locale::conv::conversion_error is thrown in a case of a error
/// ///
inline std::string narrow(wchar_t const *s) inline std::string narrow(wchar_t const *s)
{ {
return nowide::conv::utf_to_utf<char>(s); return boost::locale::conv::utf_to_utf<char>(s);
} }
/// ///
/// Convert between UTF-8 and UTF-16 string, implemented only on Windows platform /// Convert between UTF-8 and UTF-16 string, implemented only on Windows platform
/// ///
/// nowide::conv::conversion_error is thrown in a case of a error /// boost::locale::conv::conversion_error is thrown in a case of a error
/// ///
inline std::wstring widen(char const *s) inline std::wstring widen(char const *s)
{ {
return nowide::conv::utf_to_utf<wchar_t>(s); return boost::locale::conv::utf_to_utf<wchar_t>(s);
} }
/// ///
/// Convert between Wide - UTF-16/32 string and UTF-8 string /// Convert between Wide - UTF-16/32 string and UTF-8 string
/// ///
/// nowide::conv::conversion_error is thrown in a case of a error /// boost::locale::conv::conversion_error is thrown in a case of a error
/// ///
inline std::string narrow(std::wstring const &s) inline std::string narrow(std::wstring const &s)
{ {
return nowide::conv::utf_to_utf<char>(s); return boost::locale::conv::utf_to_utf<char>(s);
} }
/// ///
/// Convert between UTF-8 and UTF-16 string, implemented only on Windows platform /// Convert between UTF-8 and UTF-16 string, implemented only on Windows platform
/// ///
/// nowide::conv::conversion_error is thrown in a case of a error /// boost::locale::conv::conversion_error is thrown in a case of a error
/// ///
inline std::wstring widen(std::string const &s) inline std::wstring widen(std::string const &s)
{ {
return nowide::conv::utf_to_utf<wchar_t>(s); return boost::locale::conv::utf_to_utf<wchar_t>(s);
} }
} // nowide } // nowide
} // namespace boost
#endif #endif
/// ///
@@ -5,25 +5,25 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_CSTDIO_H_INCLUDED #ifndef BOOST_NOWIDE_CSTDIO_H_INCLUDED
#define NOWIDE_CSTDIO_H_INCLUDED #define BOOST_NOWIDE_CSTDIO_H_INCLUDED
#include <cstdio> #include <cstdio>
#include <stdio.h> #include <stdio.h>
#include <nowide/config.hpp> #include <boost/config.hpp>
#include <nowide/convert.hpp> #include <boost/nowide/convert.hpp>
#include <nowide/stackstring.hpp> #include <boost/nowide/stackstring.hpp>
#include <errno.h> #include <errno.h>
#ifdef NOWIDE_MSVC #ifdef BOOST_MSVC
# pragma warning(push) # pragma warning(push)
# pragma warning(disable : 4996) # pragma warning(disable : 4996)
#endif #endif
namespace boost {
namespace nowide { namespace nowide {
#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_DOXYGEN) #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN)
using std::fopen; using std::fopen;
using std::freopen; using std::freopen;
using std::remove; using std::remove;
@@ -90,9 +90,9 @@ inline int remove(char const *name)
} }
#endif #endif
} // nowide } // nowide
} // namespace boost
#ifdef BOOST_MSVC
#ifdef NOWIDE_MSVC
#pragma warning(pop) #pragma warning(pop)
#endif #endif
@@ -5,11 +5,11 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_CSTDLIB_HPP_INCLUDED #ifndef BOOST_NOWIDE_CSTDLIB_HPP_INCLUDED
#define NOWIDE_CSTDLIB_HPP_INCLUDED #define BOOST_NOWIDE_CSTDLIB_HPP_INCLUDED
#include <nowide/cenv.hpp> #include <boost/nowide/cenv.hpp>
#include <nowide/system.hpp> #include <boost/nowide/system.hpp>
#endif #endif
/// ///
@@ -5,25 +5,25 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_FILEBUF_HPP #ifndef BOOST_NOWIDE_FILEBUF_HPP
#define NOWIDE_FILEBUF_HPP #define BOOST_NOWIDE_FILEBUF_HPP
#include <iosfwd> #include <iosfwd>
#include <nowide/config.hpp> #include <boost/config.hpp>
#include <nowide/stackstring.hpp> #include <boost/nowide/stackstring.hpp>
#include <fstream> #include <fstream>
#include <streambuf> #include <streambuf>
#include <stdio.h> #include <stdio.h>
#ifdef NOWIDE_MSVC #ifdef BOOST_MSVC
# pragma warning(push) # pragma warning(push)
# pragma warning(disable : 4996 4244) # pragma warning(disable : 4996 4244)
#endif #endif
namespace boost {
namespace nowide { namespace nowide {
#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_FSTREAM_TESTS) && !defined(NOWIDE_DOXYGEN) #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_FSTREAM_TESTS) && !defined(BOOST_NOWIDE_DOXYGEN)
using std::basic_filebuf; using std::basic_filebuf;
using std::filebuf; using std::filebuf;
#else // Windows #else // Windows
@@ -93,8 +93,8 @@ namespace nowide {
wstackstring name; wstackstring name;
if(!name.convert(s)) if(!name.convert(s))
return 0; return 0;
#ifdef NOWIDE_FSTREAM_TESTS #ifdef BOOST_NOWIDE_FSTREAM_TESTS
FILE *f = ::fopen(s,nowide::convert(smode).c_str()); FILE *f = ::fopen(s,boost::nowide::convert(smode).c_str());
#else #else
FILE *f = ::_wfopen(name.c_str(),smode); FILE *f = ::_wfopen(name.c_str(),smode);
#endif #endif
@@ -146,7 +146,7 @@ namespace nowide {
return this; return this;
} }
#ifdef NOWIDE_DEBUG_FILEBUF #ifdef BOOST_NOWIDE_DEBUG_FILEBUF
void print_buf(char *b,char *p,char *e) void print_buf(char *b,char *p,char *e)
{ {
@@ -201,7 +201,7 @@ namespace nowide {
int overflow(int c) int overflow(int c)
{ {
#ifdef NOWIDE_DEBUG_FILEBUF #ifdef BOOST_NOWIDE_DEBUG_FILEBUF
print_guard g(this,__FUNCTION__); print_guard g(this,__FUNCTION__);
#endif #endif
if(!file_) if(!file_)
@@ -239,7 +239,7 @@ namespace nowide {
int underflow() int underflow()
{ {
#ifdef NOWIDE_DEBUG_FILEBUF #ifdef BOOST_NOWIDE_DEBUG_FILEBUF
print_guard g(this,__FUNCTION__); print_guard g(this,__FUNCTION__);
#endif #endif
if(!file_) if(!file_)
@@ -272,7 +272,7 @@ namespace nowide {
std::ios_base::seekdir seekdir, std::ios_base::seekdir seekdir,
std::ios_base::openmode /*m*/) std::ios_base::openmode /*m*/)
{ {
#ifdef NOWIDE_DEBUG_FILEBUF #ifdef BOOST_NOWIDE_DEBUG_FILEBUF
print_guard g(this,__FUNCTION__); print_guard g(this,__FUNCTION__);
#endif #endif
if(!file_) if(!file_)
@@ -396,9 +396,9 @@ namespace nowide {
#endif // windows #endif // windows
} // nowide } // nowide
} // namespace boost
#ifdef BOOST_MSVC
#ifdef NOWIDE_MSVC
# pragma warning(pop) # pragma warning(pop)
#endif #endif
@@ -5,25 +5,25 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_FSTREAM_INCLUDED_HPP #ifndef BOOST_NOWIDE_FSTREAM_INCLUDED_HPP
#define NOWIDE_FSTREAM_INCLUDED_HPP #define BOOST_NOWIDE_FSTREAM_INCLUDED_HPP
#include <iosfwd> #include <iosfwd>
#include <nowide/config.hpp> #include <boost/config.hpp>
#include <nowide/convert.hpp> #include <boost/nowide/convert.hpp>
#include <nowide/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <fstream> #include <fstream>
#include <memory> #include <memory>
#include <nowide/filebuf.hpp> #include <boost/nowide/filebuf.hpp>
namespace boost {
/// ///
/// \brief This namespace includes implementation of the standard library functios /// \brief This namespace includes implementation of the standard library functios
/// such that they accept UTF-8 strings on Windows. On other platforms it is just an alias /// such that they accept UTF-8 strings on Windows. On other platforms it is just an alias
/// of std namespace (i.e. not on Windows) /// of std namespace (i.e. not on Windows)
/// ///
namespace nowide { namespace nowide {
#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_FSTREAM_TESTS) && !defined(NOWIDE_DOXYGEN) #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_FSTREAM_TESTS) && !defined(BOOST_NOWIDE_DOXYGEN)
using std::basic_ifstream; using std::basic_ifstream;
using std::basic_ofstream; using std::basic_ofstream;
@@ -93,7 +93,7 @@ namespace nowide {
} }
private: private:
nowide::scoped_ptr<internal_buffer_type> buf_; boost::scoped_ptr<internal_buffer_type> buf_;
}; };
/// ///
@@ -155,7 +155,7 @@ namespace nowide {
} }
private: private:
nowide::scoped_ptr<internal_buffer_type> buf_; boost::scoped_ptr<internal_buffer_type> buf_;
}; };
/// ///
@@ -217,7 +217,7 @@ namespace nowide {
} }
private: private:
nowide::scoped_ptr<internal_buffer_type> buf_; boost::scoped_ptr<internal_buffer_type> buf_;
}; };
@@ -240,7 +240,7 @@ namespace nowide {
#endif #endif
} // nowide } // nowide
} // namespace boost
@@ -5,24 +5,24 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_IOSTREAM_HPP_INCLUDED #ifndef BOOST_NOWIDE_IOSTREAM_HPP_INCLUDED
#define NOWIDE_IOSTREAM_HPP_INCLUDED #define BOOST_NOWIDE_IOSTREAM_HPP_INCLUDED
#include <nowide/config.hpp> #include <boost/nowide/config.hpp>
#include <nowide/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <iostream> #include <iostream>
#include <ostream> #include <ostream>
#include <istream> #include <istream>
#ifdef NOWIDE_MSVC #ifdef BOOST_MSVC
# pragma warning(push) # pragma warning(push)
# pragma warning(disable : 4251) # pragma warning(disable : 4251)
#endif #endif
namespace boost {
namespace nowide { namespace nowide {
#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_DOXYGEN) #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN)
using std::cout; using std::cout;
using std::cerr; using std::cerr;
using std::cin; using std::cin;
@@ -34,17 +34,17 @@ namespace nowide {
class console_output_buffer; class console_output_buffer;
class console_input_buffer; class console_input_buffer;
class NOWIDE_DECL winconsole_ostream : public std::ostream { class BOOST_NOWIDE_DECL winconsole_ostream : public std::ostream {
winconsole_ostream(winconsole_ostream const &); winconsole_ostream(winconsole_ostream const &);
void operator=(winconsole_ostream const &); void operator=(winconsole_ostream const &);
public: public:
winconsole_ostream(int fd); winconsole_ostream(int fd);
~winconsole_ostream(); ~winconsole_ostream();
private: private:
nowide::scoped_ptr<console_output_buffer> d; boost::scoped_ptr<console_output_buffer> d;
}; };
class NOWIDE_DECL winconsole_istream : public std::istream { class BOOST_NOWIDE_DECL winconsole_istream : public std::istream {
winconsole_istream(winconsole_istream const &); winconsole_istream(winconsole_istream const &);
void operator=(winconsole_istream const &); void operator=(winconsole_istream const &);
public: public:
@@ -53,7 +53,7 @@ namespace nowide {
~winconsole_istream(); ~winconsole_istream();
private: private:
struct data; struct data;
nowide::scoped_ptr<console_input_buffer> d; boost::scoped_ptr<console_input_buffer> d;
}; };
} // details } // details
@@ -64,32 +64,32 @@ namespace nowide {
/// ///
/// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
/// ///
extern NOWIDE_DECL details::winconsole_istream cin; extern BOOST_NOWIDE_DECL details::winconsole_istream cin;
/// ///
/// \brief Same as std::cout, but uses UTF-8 /// \brief Same as std::cout, but uses UTF-8
/// ///
/// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
/// ///
extern NOWIDE_DECL details::winconsole_ostream cout; extern BOOST_NOWIDE_DECL details::winconsole_ostream cout;
/// ///
/// \brief Same as std::cerr, but uses UTF-8 /// \brief Same as std::cerr, but uses UTF-8
/// ///
/// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
/// ///
extern NOWIDE_DECL details::winconsole_ostream cerr; extern BOOST_NOWIDE_DECL details::winconsole_ostream cerr;
/// ///
/// \brief Same as std::clog, but uses UTF-8 /// \brief Same as std::clog, but uses UTF-8
/// ///
/// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio /// Note, the stream is not synchronized with stdio and not affected by std::ios::sync_with_stdio
/// ///
extern NOWIDE_DECL details::winconsole_ostream clog; extern BOOST_NOWIDE_DECL details::winconsole_ostream clog;
#endif #endif
} // nowide } // nowide
} // namespace boost
#ifdef BOOST_MSVC
#ifdef NOWIDE_MSVC
# pragma warning(pop) # pragma warning(pop)
#endif #endif
@@ -5,13 +5,13 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_DETAILS_WIDESTR_H_INCLUDED #ifndef BOOST_NOWIDE_DETAILS_WIDESTR_H_INCLUDED
#define NOWIDE_DETAILS_WIDESTR_H_INCLUDED #define BOOST_NOWIDE_DETAILS_WIDESTR_H_INCLUDED
#include <nowide/convert.hpp> #include <boost/nowide/convert.hpp>
#include <string.h> #include <string.h>
#include <algorithm> #include <algorithm>
namespace boost {
namespace nowide { namespace nowide {
/// ///
@@ -147,7 +147,7 @@ typedef basic_stackstring<char,wchar_t,16> short_stackstring;
} // nowide } // nowide
} // namespace boost
#endif #endif
/// ///
@@ -5,16 +5,16 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_CSTDLIB_HPP #ifndef BOOST_NOWIDE_CSTDLIB_HPP
#define NOWIDE_CSTDLIB_HPP #define BOOST_NOWIDE_CSTDLIB_HPP
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <nowide/stackstring.hpp> #include <boost/nowide/stackstring.hpp>
namespace boost {
namespace nowide { namespace nowide {
#if !defined(NOWIDE_WINDOWS) && !defined(NOWIDE_DOXYGEN) #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN)
using ::system; using ::system;
@@ -39,7 +39,7 @@ inline int system(char const *cmd)
#endif #endif
} // nowide } // nowide
} // namespace boost
#endif #endif
/// ///
@@ -5,12 +5,12 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#ifndef NOWIDE_WINDOWS_HPP_INCLUDED #ifndef BOOST_NOWIDE_WINDOWS_HPP_INCLUDED
#define NOWIDE_WINDOWS_HPP_INCLUDED #define BOOST_NOWIDE_WINDOWS_HPP_INCLUDED
#include <stddef.h> #include <stddef.h>
#ifdef NOWIDE_USE_WINDOWS_H #ifdef BOOST_NOWIDE_USE_WINDOWS_H
#include <windows.h> #include <windows.h>
#else #else
-37
View File
@@ -1,37 +0,0 @@
//
// Copyright (c) 2012 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef NOWIDE_CONFIG_H_INCLUDED
#define NOWIDE_CONFIG_H_INCLUDED
#if (defined(__WIN32) || defined(_WIN32) || defined(WIN32)) && !defined(__CYGWIN__)
#define NOWIDE_WINDOWS
#endif
#ifdef _MSC_VER
#define NOWIDE_MSVC
#endif
#ifdef NOWIDE_WINDOWS
# if defined(DLL_EXPORT) || defined(NOWIDE_EXPORT)
# ifdef NOWIDE_SOURCE
# define NOWIDE_DECL __declspec(dllexport)
# else
# define NOWIDE_DECL __declspec(dllimport)
# endif //NOWIDE_SOURCE
# endif // DYN_LINK
#endif
#ifndef NOWIDE_DECL
# define NOWIDE_DECL
#endif
#endif
///
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
-58
View File
@@ -1,58 +0,0 @@
//
// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef NOWIDE_ENCODING_ERRORS_HPP_INCLUDED
#define NOWIDE_ENCODING_ERRORS_HPP_INCLUDED
#include <nowide/config.hpp>
#ifdef NOWIDE_MSVC
# pragma warning(push)
# pragma warning(disable : 4275 4251 4231 4660)
#endif
#include <stdexcept>
namespace nowide {
namespace conv {
///
/// \addtogroup codepage
///
/// @{
///
/// \brief The excepton that is thrown in case of conversion error
///
class conversion_error : public std::runtime_error {
public:
conversion_error() : std::runtime_error("Conversion failed") {}
};
///
/// enum that defines conversion policy
///
typedef enum {
skip = 0, ///< Skip illegal/unconvertable characters
stop = 1, ///< Stop conversion and throw conversion_error
default_method = skip ///< Default method - skip
} method_type;
/// @}
} // conv
} // nowide
#ifdef NOWIDE_MSVC
#pragma warning(pop)
#endif
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
-84
View File
@@ -1,84 +0,0 @@
//
// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef NOWIDE_ENCODING_UTF_HPP_INCLUDED
#define NOWIDE_ENCODING_UTF_HPP_INCLUDED
#include <nowide/utf.hpp>
#include <nowide/encoding_errors.hpp>
#include <string>
#include <iterator>
#ifdef NOWIDE_MSVC
# pragma warning(push)
# pragma warning(disable : 4275 4251 4231 4660)
#endif
namespace nowide{
namespace conv {
///
/// Convert a Unicode text in range [begin,end) to other Unicode encoding
///
template<typename CharOut,typename CharIn>
std::basic_string<CharOut>
utf_to_utf(CharIn const *begin,CharIn const *end,method_type how = default_method)
{
std::basic_string<CharOut> result;
result.reserve(end-begin);
typedef std::back_insert_iterator<std::basic_string<CharOut> > inserter_type;
inserter_type inserter(result);
utf::code_point c;
while(begin!=end) {
c=utf::utf_traits<CharIn>::template decode<CharIn const *>(begin,end);
if(c==utf::illegal || c==utf::incomplete) {
if(how==stop)
throw conversion_error();
}
else {
utf::utf_traits<CharOut>::template encode<inserter_type>(c,inserter);
}
}
return result;
}
///
/// Convert a Unicode NUL terminated string \a str other Unicode encoding
///
template<typename CharOut,typename CharIn>
std::basic_string<CharOut>
utf_to_utf(CharIn const *str,method_type how = default_method)
{
CharIn const *end = str;
while(*end)
end++;
return utf_to_utf<CharOut,CharIn>(str,end,how);
}
///
/// Convert a Unicode string \a str other Unicode encoding
///
template<typename CharOut,typename CharIn>
std::basic_string<CharOut>
utf_to_utf(std::basic_string<CharIn> const &str,method_type how = default_method)
{
return utf_to_utf<CharOut,CharIn>(str.c_str(),str.c_str()+str.size(),how);
}
} // conv
} // nowide
#ifdef NOWIDE_MSVC
#pragma warning(pop)
#endif
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
-93
View File
@@ -1,93 +0,0 @@
#ifndef NOWIDE_SCOPED_PTR_HPP
#define NOWIDE_SCOPED_PTR_HPP
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
// Copyright (c) 2001, 2002 Peter Dimov,
// Copyright (C) 2012 Artyom Beilis
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// http://www.boost.org/libs/smart_ptr/scoped_ptr.htm
//
#include <assert.h>
namespace nowide
{
// scoped_ptr mimics a built-in pointer except that it guarantees deletion
// of the object pointed to, either on destruction of the scoped_ptr or via
// an explicit reset(). scoped_ptr is a simple solution for simple needs;
// use shared_ptr or std::auto_ptr if your needs are more complex.
template<class T> class scoped_ptr // noncopyable
{
private:
T * px;
scoped_ptr(scoped_ptr const &);
scoped_ptr & operator=(scoped_ptr const &);
typedef scoped_ptr<T> this_type;
void operator==( scoped_ptr const& ) const;
void operator!=( scoped_ptr const& ) const;
public:
typedef T element_type;
explicit scoped_ptr( T * p = 0 ): px( p ) // never throws
{
}
~scoped_ptr() // never throws
{
delete px;
}
void reset(T * p = 0) // never throws
{
assert( p == 0 || p != px ); // catch self-reset errors
this_type(p).swap(*this);
}
T & operator*() const // never throws
{
assert( px != 0 );
return *px;
}
T * operator->() const // never throws
{
assert( px != 0 );
return px;
}
T * get() const // never throws
{
return px;
}
operator bool() const
{
return px!=0;
}
void swap(scoped_ptr & b) // never throws
{
T * tmp = b.px;
b.px = px;
px = tmp;
}
};
} // namespace nowide
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
-469
View File
@@ -1,469 +0,0 @@
//
// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef NOWIDE_UTF_HPP_INCLUDED
#define NOWIDE_UTF_HPP_INCLUDED
#include <nowide/config.hpp>
#ifndef NOWIDE_MSVC
namespace nowide {
namespace utf {
typedef unsigned uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
}
}
#else
#include <stdint.h>
#endif
namespace nowide {
///
/// \brief Namespace that holds basic operations on UTF encoded sequences
///
/// All functions defined in this namespace do not require linking with Boost.Locale library
///
namespace utf {
/// \cond INTERNAL
#ifdef __GNUC__
# define NOWIDE_LIKELY(x) __builtin_expect((x),1)
# define NOWIDE_UNLIKELY(x) __builtin_expect((x),0)
#else
# define NOWIDE_LIKELY(x) (x)
# define NOWIDE_UNLIKELY(x) (x)
#endif
/// \endcond
///
/// \brief The integral type type that can hold a Unicode code point
///
typedef uint32_t code_point;
///
/// \brief Special constant that defines illegal code point
///
static const code_point illegal = 0xFFFFFFFFu;
///
/// \brief Special constant that defines incomplete code point
///
static const code_point incomplete = 0xFFFFFFFEu;
///
/// \brief the function checks if \a v is a valid code point
///
inline bool is_valid_codepoint(code_point v)
{
if(v>0x10FFFF)
return false;
if(0xD800 <=v && v<= 0xDFFF) // surragates
return false;
return true;
}
#ifdef NOWIDE_DOXYGEN
///
/// \brief UTF Traits class - functions to convert UTF sequences to and from Unicode code points
///
template<typename CharType,int size=sizeof(CharType)>
struct utf_traits {
///
/// The type of the character
///
typedef CharType char_type;
///
/// Read one code point from the range [p,e) and return it.
///
/// - If the sequence that was read is incomplete sequence returns \ref incomplete,
/// - If illegal sequence detected returns \ref illegal
///
/// Requirements
///
/// - Iterator is valid input iterator
///
/// Postconditions
///
/// - p points to the last consumed character
///
template<typename Iterator>
static code_point decode(Iterator &p,Iterator e);
///
/// Maximal width of valid sequence in the code units:
///
/// - UTF-8 - 4
/// - UTF-16 - 2
/// - UTF-32 - 1
///
static const int max_width;
///
/// The width of specific code point in the code units.
///
/// Requirement: value is a valid Unicode code point
/// Returns value in range [1..max_width]
///
static int width(code_point value);
///
/// Get the size of the trail part of variable length encoded sequence.
///
/// Returns -1 if C is not valid lead character
///
static int trail_length(char_type c);
///
/// Returns true if c is trail code unit, always false for UTF-32
///
static bool is_trail(char_type c);
///
/// Returns true if c is lead code unit, always true of UTF-32
///
static bool is_lead(char_type c);
///
/// Convert valid Unicode code point \a value to the UTF sequence.
///
/// Requirements:
///
/// - \a value is valid code point
/// - \a out is an output iterator should be able to accept at least width(value) units
///
/// Returns the iterator past the last written code unit.
///
template<typename Iterator>
static Iterator encode(code_point value,Iterator out);
///
/// Decodes valid UTF sequence that is pointed by p into code point.
///
/// If the sequence is invalid or points to end the behavior is undefined
///
template<typename Iterator>
static code_point decode_valid(Iterator &p);
};
#else
template<typename CharType,int size=sizeof(CharType)>
struct utf_traits;
template<typename CharType>
struct utf_traits<CharType,1> {
typedef CharType char_type;
static int trail_length(char_type ci)
{
unsigned char c = ci;
if(c < 128)
return 0;
if(NOWIDE_UNLIKELY(c < 194))
return -1;
if(c < 224)
return 1;
if(c < 240)
return 2;
if(NOWIDE_LIKELY(c <=244))
return 3;
return -1;
}
static const int max_width = 4;
static int width(code_point value)
{
if(value <=0x7F) {
return 1;
}
else if(value <=0x7FF) {
return 2;
}
else if(NOWIDE_LIKELY(value <=0xFFFF)) {
return 3;
}
else {
return 4;
}
}
static bool is_trail(char_type ci)
{
unsigned char c=ci;
return (c & 0xC0)==0x80;
}
static bool is_lead(char_type ci)
{
return !is_trail(ci);
}
template<typename Iterator>
static code_point decode(Iterator &p,Iterator e)
{
if(NOWIDE_UNLIKELY(p==e))
return incomplete;
unsigned char lead = *p++;
// First byte is fully validated here
int trail_size = trail_length(lead);
if(NOWIDE_UNLIKELY(trail_size < 0))
return illegal;
//
// Ok as only ASCII may be of size = 0
// also optimize for ASCII text
//
if(trail_size == 0)
return lead;
code_point c = lead & ((1<<(6-trail_size))-1);
// Read the rest
unsigned char tmp;
switch(trail_size) {
case 3:
if(NOWIDE_UNLIKELY(p==e))
return incomplete;
tmp = *p++;
if (!is_trail(tmp))
return illegal;
c = (c << 6) | ( tmp & 0x3F);
case 2:
if(NOWIDE_UNLIKELY(p==e))
return incomplete;
tmp = *p++;
if (!is_trail(tmp))
return illegal;
c = (c << 6) | ( tmp & 0x3F);
case 1:
if(NOWIDE_UNLIKELY(p==e))
return incomplete;
tmp = *p++;
if (!is_trail(tmp))
return illegal;
c = (c << 6) | ( tmp & 0x3F);
}
// Check code point validity: no surrogates and
// valid range
if(NOWIDE_UNLIKELY(!is_valid_codepoint(c)))
return illegal;
// make sure it is the most compact representation
if(NOWIDE_UNLIKELY(width(c)!=trail_size + 1))
return illegal;
return c;
}
template<typename Iterator>
static code_point decode_valid(Iterator &p)
{
unsigned char lead = *p++;
if(lead < 192)
return lead;
int trail_size;
if(lead < 224)
trail_size = 1;
else if(NOWIDE_LIKELY(lead < 240)) // non-BMP rare
trail_size = 2;
else
trail_size = 3;
code_point c = lead & ((1<<(6-trail_size))-1);
switch(trail_size) {
case 3:
c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F);
case 2:
c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F);
case 1:
c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F);
}
return c;
}
template<typename Iterator>
static Iterator encode(code_point value,Iterator out)
{
if(value <= 0x7F) {
*out++ = static_cast<char_type>(value);
}
else if(value <= 0x7FF) {
*out++ = static_cast<char_type>((value >> 6) | 0xC0);
*out++ = static_cast<char_type>((value & 0x3F) | 0x80);
}
else if(NOWIDE_LIKELY(value <= 0xFFFF)) {
*out++ = static_cast<char_type>((value >> 12) | 0xE0);
*out++ = static_cast<char_type>(((value >> 6) & 0x3F) | 0x80);
*out++ = static_cast<char_type>((value & 0x3F) | 0x80);
}
else {
*out++ = static_cast<char_type>((value >> 18) | 0xF0);
*out++ = static_cast<char_type>(((value >> 12) & 0x3F) | 0x80);
*out++ = static_cast<char_type>(((value >> 6) & 0x3F) | 0x80);
*out++ = static_cast<char_type>((value & 0x3F) | 0x80);
}
return out;
}
}; // utf8
template<typename CharType>
struct utf_traits<CharType,2> {
typedef CharType char_type;
// See RFC 2781
static bool is_first_surrogate(uint16_t x)
{
return 0xD800 <=x && x<= 0xDBFF;
}
static bool is_second_surrogate(uint16_t x)
{
return 0xDC00 <=x && x<= 0xDFFF;
}
static code_point combine_surrogate(uint16_t w1,uint16_t w2)
{
return ((code_point(w1 & 0x3FF) << 10) | (w2 & 0x3FF)) + 0x10000;
}
static int trail_length(char_type c)
{
if(is_first_surrogate(c))
return 1;
if(is_second_surrogate(c))
return -1;
return 0;
}
///
/// Returns true if c is trail code unit, always false for UTF-32
///
static bool is_trail(char_type c)
{
return is_second_surrogate(c);
}
///
/// Returns true if c is lead code unit, always true of UTF-32
///
static bool is_lead(char_type c)
{
return !is_second_surrogate(c);
}
template<typename It>
static code_point decode(It &current,It last)
{
if(NOWIDE_UNLIKELY(current == last))
return incomplete;
uint16_t w1=*current++;
if(NOWIDE_LIKELY(w1 < 0xD800 || 0xDFFF < w1)) {
return w1;
}
if(w1 > 0xDBFF)
return illegal;
if(current==last)
return incomplete;
uint16_t w2=*current++;
if(w2 < 0xDC00 || 0xDFFF < w2)
return illegal;
return combine_surrogate(w1,w2);
}
template<typename It>
static code_point decode_valid(It &current)
{
uint16_t w1=*current++;
if(NOWIDE_LIKELY(w1 < 0xD800 || 0xDFFF < w1)) {
return w1;
}
uint16_t w2=*current++;
return combine_surrogate(w1,w2);
}
static const int max_width = 2;
static int width(code_point u)
{
return u>=0x10000 ? 2 : 1;
}
template<typename It>
static It encode(code_point u,It out)
{
if(NOWIDE_LIKELY(u<=0xFFFF)) {
*out++ = static_cast<char_type>(u);
}
else {
u -= 0x10000;
*out++ = static_cast<char_type>(0xD800 | (u>>10));
*out++ = static_cast<char_type>(0xDC00 | (u & 0x3FF));
}
return out;
}
}; // utf16;
template<typename CharType>
struct utf_traits<CharType,4> {
typedef CharType char_type;
static int trail_length(char_type c)
{
if(is_valid_codepoint(c))
return 0;
return -1;
}
static bool is_trail(char_type /*c*/)
{
return false;
}
static bool is_lead(char_type /*c*/)
{
return true;
}
template<typename It>
static code_point decode_valid(It &current)
{
return *current++;
}
template<typename It>
static code_point decode(It &current,It last)
{
if(NOWIDE_UNLIKELY(current == last))
return nowide::utf::incomplete;
code_point c=*current++;
if(NOWIDE_UNLIKELY(!is_valid_codepoint(c)))
return nowide::utf::illegal;
return c;
}
static const int max_width = 1;
static int width(code_point /*u*/)
{
return 1;
}
template<typename It>
static It encode(code_point u,It out)
{
*out++ = static_cast<char_type>(u);
return out;
}
}; // utf32
#endif
} // utf
} // nowide
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
+26
View File
@@ -0,0 +1,26 @@
project(RebootInto)
find_package(TCLAP REQUIRED)
find_package(Boost REQUIRED COMPONENTS locale)
find_package(Nowide REQUIRED)
include_directories(
${INCLUDE_PATH}
${TCLAP_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${Nowide_INCLUDE_DIRS}
)
set(SOURCE_FILES
main.cpp
)
source_group("" FILES ${SOURCE_FILES})
if(MSVC)
add_definitions(-DUNICODE -D_UNICODE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT /Ox /Os")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE /level='requireAdministrator'")
endif()
add_executable(RebootInto ${SOURCE_FILES})
+2 -2
View File
@@ -8,12 +8,12 @@
#include <memory> #include <memory>
#define NOMINMAX #define NOMINMAX
#include <Windows.h> #include <Windows.h>
#include <nowide/convert.hpp> #include <boost/nowide/convert.hpp>
//#define TCLAP_NAMESTARTSTRING "/" //#define TCLAP_NAMESTARTSTRING "/"
//#define TCLAP_FLAGSTARTSTRING "/" //#define TCLAP_FLAGSTARTSTRING "/"
#include <tclap/CmdLine.h> #include <tclap/CmdLine.h>
using namespace nowide; using namespace boost::nowide;
#define VERSION "1.0.1" #define VERSION "1.0.1"
#define EFI_GLOBAL_VARIABLE L"{8BE4DF61-93CA-11D2-AA0D-00E098032B8C}" #define EFI_GLOBAL_VARIABLE L"{8BE4DF61-93CA-11D2-AA0D-00E098032B8C}"