mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
restructure source and clean up cmake scripts
This commit is contained in:
parent
90d8d545ed
commit
2c8ccdfcda
|
@ -1,7 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
subprocess.call(['sh', 'build-osx.sh'])
|
|
|
@ -1,2 +1,2 @@
|
||||||
cd ${0%/*}
|
cd ${0%/*}
|
||||||
../third-party/cxxtest/bin/cxxtestgen --runner=ErrorPrinter -o ../tests/runner-autogen.cpp ../tests/*.hpp
|
../third-party/cxxtest/bin/cxxtestgen --runner=ErrorPrinter -o ../tests/runner-autogen.cpp ../tests/*.hpp ../source/*/tests/*.hpp
|
|
@ -1,2 +1,2 @@
|
||||||
cd %~dp0
|
cd %~dp0
|
||||||
../third-party/cxxtest/bin/cxxtestgen --runner=ErrorPrinter -o ../tests/runner-autogen.cpp ../tests/*.hpp
|
../third-party/cxxtest/bin/cxxtestgen --runner=ErrorPrinter -o ../tests/runner-autogen.cpp ../tests/*.hpp ../source/*/tests/*.hpp
|
53
cmake/summarize_tests.py
Normal file
53
cmake/summarize_tests.py
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def title_case_to_underscore(name):
|
||||||
|
a = re.compile('((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))')
|
||||||
|
return a.sub(r'_\1', name).lower()
|
||||||
|
|
||||||
|
def list_tests(filename):
|
||||||
|
f = open(filename)
|
||||||
|
|
||||||
|
in_class = False
|
||||||
|
class_name = ''
|
||||||
|
|
||||||
|
for line in f:
|
||||||
|
if line.startswith('class '):
|
||||||
|
in_class = True
|
||||||
|
class_name = line.split(' ')[1][:-2]
|
||||||
|
if '(' in class_name:
|
||||||
|
class_name = class_name.split('(')[0]
|
||||||
|
continue
|
||||||
|
|
||||||
|
if in_class and not (line.startswith(' ') or line.strip() == ''):
|
||||||
|
in_class = False
|
||||||
|
continue
|
||||||
|
|
||||||
|
if line.lstrip().startswith('def test_'):
|
||||||
|
if in_class:
|
||||||
|
print('\t' + title_case_to_underscore(class_name) + '__' + line.split()[1].split('(')[0])
|
||||||
|
else:
|
||||||
|
print('\t' + line.split()[1].split('(')[0])
|
||||||
|
|
||||||
|
def find_test_files(dir):
|
||||||
|
files = []
|
||||||
|
|
||||||
|
for f in os.listdir(dir):
|
||||||
|
if os.path.isdir(os.path.join(dir, f)):
|
||||||
|
files.extend(find_test_files(os.path.join(dir, f)))
|
||||||
|
elif os.path.isfile(os.path.join(dir, f)) and f.endswith('.py') and f.startswith('test_'):
|
||||||
|
files.append(os.path.join(dir, f))
|
||||||
|
|
||||||
|
return files
|
||||||
|
|
||||||
|
def main():
|
||||||
|
directory = sys.argv[1] if len(sys.argv) > 1 else os.path.dirname(os.path.abspath(__file__))
|
||||||
|
test_files = find_test_files(directory)
|
||||||
|
for test_file in test_files:
|
||||||
|
print(test_file.split('openpyxl/')[1], end='')
|
||||||
|
list_tests(test_file)
|
||||||
|
print()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
11
cmake/test
11
cmake/test
|
@ -1,11 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
subprocess.call('./build')
|
|
||||||
|
|
||||||
if os.path.isdir('../bin') and os.path.isfile('../bin/xlnt.test'):
|
|
||||||
os.chdir('../bin')
|
|
||||||
subprocess.call(['./xlnt.test'])
|
|
|
@ -9,41 +9,51 @@ FILE(GLOB ROOT_HEADERS ../include/xlnt/*.hpp)
|
||||||
FILE(GLOB CELL_HEADERS ../include/xlnt/cell/*.hpp)
|
FILE(GLOB CELL_HEADERS ../include/xlnt/cell/*.hpp)
|
||||||
FILE(GLOB CHARTS_HEADERS ../include/xlnt/charts/*.hpp)
|
FILE(GLOB CHARTS_HEADERS ../include/xlnt/charts/*.hpp)
|
||||||
FILE(GLOB CHARTSHEET_HEADERS ../include/xlnt/chartsheet/*.hpp)
|
FILE(GLOB CHARTSHEET_HEADERS ../include/xlnt/chartsheet/*.hpp)
|
||||||
FILE(GLOB COMMON_HEADERS ../include/xlnt/common/*.hpp)
|
|
||||||
FILE(GLOB DRAWING_HEADERS ../include/xlnt/drawing/*.hpp)
|
FILE(GLOB DRAWING_HEADERS ../include/xlnt/drawing/*.hpp)
|
||||||
FILE(GLOB FORUMULA_HEADERS ../include/xlnt/formula/*.hpp)
|
FILE(GLOB FORUMULA_HEADERS ../include/xlnt/formula/*.hpp)
|
||||||
FILE(GLOB PACKAGING_HEADERS ../include/xlnt/packaging/*.hpp)
|
FILE(GLOB PACKAGING_HEADERS ../include/xlnt/packaging/*.hpp)
|
||||||
FILE(GLOB SERIALIZATION_HEADERS ../include/xlnt/serialization/*.hpp)
|
FILE(GLOB SERIALIZATION_HEADERS ../include/xlnt/serialization/*.hpp)
|
||||||
FILE(GLOB STYLES_HEADERS ../include/xlnt/styles/*.hpp)
|
FILE(GLOB STYLES_HEADERS ../include/xlnt/styles/*.hpp)
|
||||||
|
FILE(GLOB UTILS_HEADERS ../include/xlnt/utils/*.hpp)
|
||||||
FILE(GLOB WORKBOOK_HEADERS ../include/xlnt/workbook/*.hpp)
|
FILE(GLOB WORKBOOK_HEADERS ../include/xlnt/workbook/*.hpp)
|
||||||
FILE(GLOB WORKSHEET_HEADERS ../include/xlnt/worksheet/*.hpp)
|
FILE(GLOB WORKSHEET_HEADERS ../include/xlnt/worksheet/*.hpp)
|
||||||
FILE(GLOB DETAIL_HEADERS ../source/detail/*.hpp)
|
FILE(GLOB DETAIL_HEADERS ../source/detail/*.hpp)
|
||||||
|
|
||||||
FILE(GLOB DETAIL_SOURCES ../source/detail/*.cpp)
|
SET(HEADERS ${ROOT_HEADERS} ${CELL_HEADERS} ${CHARTS_HEADERS} ${CHARTSHEET_HEADERS} ${DRAWING_HEADERS} ${FORMULA_HEADERS} ${PACKAGING_HEADERS} ${SERIALIZATION_HEADERS} ${STYLES_HEADERS} ${UTILS_HEADERS} ${WORKBOOK_HEADERS} ${WORKSHEET_HEADERS} ${DETAIL_HEADERS})
|
||||||
|
|
||||||
FILE(GLOB CELL_SOURCES ../source/cell/*.cpp)
|
FILE(GLOB CELL_SOURCES ../source/cell/*.cpp)
|
||||||
FILE(GLOB CHARTS_SOURCES ../source/charts/*.cpp)
|
FILE(GLOB CHARTS_SOURCES ../source/charts/*.cpp)
|
||||||
FILE(GLOB CHARTSHEET_SOURCES ../source/chartsheet/*.cpp)
|
FILE(GLOB CHARTSHEET_SOURCES ../source/chartsheet/*.cpp)
|
||||||
FILE(GLOB COMMON_SOURCES ../source/common/*.cpp)
|
|
||||||
FILE(GLOB DRAWING_SOURCES ../source/drawing/*.cpp)
|
FILE(GLOB DRAWING_SOURCES ../source/drawing/*.cpp)
|
||||||
FILE(GLOB FORUMULA_SOURCES ../source/formula/*.cpp)
|
FILE(GLOB FORUMULA_SOURCES ../source/formula/*.cpp)
|
||||||
FILE(GLOB PACKAGING_SOURCES ../source/packaging/*.cpp)
|
FILE(GLOB PACKAGING_SOURCES ../source/packaging/*.cpp)
|
||||||
FILE(GLOB SERIALIZATION_SOURCES ../source/serialization/*.cpp)
|
FILE(GLOB SERIALIZATION_SOURCES ../source/serialization/*.cpp)
|
||||||
FILE(GLOB STYLES_SOURCES ../source/styles/*.cpp)
|
FILE(GLOB STYLES_SOURCES ../source/styles/*.cpp)
|
||||||
|
FILE(GLOB UTILS_SOURCES ../source/utils/*.cpp)
|
||||||
FILE(GLOB WORKBOOK_SOURCES ../source/workbook/*.cpp)
|
FILE(GLOB WORKBOOK_SOURCES ../source/workbook/*.cpp)
|
||||||
FILE(GLOB WORKSHEET_SOURCES ../source/worksheet/*.cpp)
|
FILE(GLOB WORKSHEET_SOURCES ../source/worksheet/*.cpp)
|
||||||
|
FILE(GLOB DETAIL_SOURCES ../source/detail/*.cpp)
|
||||||
|
|
||||||
add_library(xlnt STATIC ${DETAIL_HEADERS} ${CELL_HEADERS} ${CHARTS_HEADERS} ${CHARTSHEET_HEADERS} ${COMMON_HEADERS} ${DRAWING_HEADERS} ${FORMULA_HEADERS} ${PACKAGING_HEADERS} ${SERIALIZATION_HEADERS} ${STYLES_HEADERS} ${WORKBOOK_HEADERS} ${WORKSHEET_HEADERS} ${DETAIL_SOURCES} ${CELL_SOURCES} ${CHARTS_SOURCES} ${CHARTSHEET_SOURCES} ${COMMON_SOURCES} ${DRAWING_SOURCES} ${FORMULA_SOURCES} ${PACKAGING_SOURCES} ${SERIALIZATION_SOURCES} ${STYLES_SOURCES} ${WORKBOOK_SOURCES} ${WORKSHEET_SOURCES} ../third-party/pugixml/src/pugixml.cpp ../third-party/miniz/miniz.c)
|
SET(SOURCES ${CELL_SOURCES} ${CHARTS_SOURCES} ${CHARTSHEET_SOURCES} ${DRAWING_SOURCES} ${FORMULA_SOURCES} ${PACKAGING_SOURCES} ${SERIALIZATION_SOURCES} ${STYLES_SOURCES} ${UTILS_SOURCES} ${WORKBOOK_SOURCES} ${WORKSHEET_SOURCES} ${DETAIL_SOURCES})
|
||||||
|
|
||||||
|
SET(MINIZ ../third-party/miniz/miniz.c ../third-party/miniz/miniz.h)
|
||||||
|
|
||||||
|
SET(PUGIXML ../third-party/pugixml/src/pugixml.hpp ../third-party/pugixml/src/pugixml.cpp ../third-party/pugixml/src/pugiconfig.hpp)
|
||||||
|
|
||||||
|
add_library(xlnt STATIC ${HEADERS} ${SOURCES} ${MINIZ} ${PUGIXML})
|
||||||
|
|
||||||
|
source_group(xlnt FILES ${ROOT_HEADERS})
|
||||||
source_group(detail FILES ${DETAIL_HEADERS} ${DETAIL_SOURCES})
|
source_group(detail FILES ${DETAIL_HEADERS} ${DETAIL_SOURCES})
|
||||||
source_group(cell FILES ${CELL_HEADERS} ${CELL_SOURCES})
|
source_group(cell FILES ${CELL_HEADERS} ${CELL_SOURCES})
|
||||||
source_group(charts FILES ${CHARTS_HEADERS} ${CHARTS_SOURCES})
|
source_group(charts FILES ${CHARTS_HEADERS} ${CHARTS_SOURCES})
|
||||||
source_group(chartsheet FILES ${CHARTSHEET_HEADERS} ${CHARTSHEET_SOURCES})
|
source_group(chartsheet FILES ${CHARTSHEET_HEADERS} ${CHARTSHEET_SOURCES})
|
||||||
source_group(common FILES ${COMMON_HEADERS} ${COMMON_SOURCES})
|
|
||||||
source_group(drawing FILES ${DRAWING_HEADERS} ${DRAWING_SOURCES})
|
source_group(drawing FILES ${DRAWING_HEADERS} ${DRAWING_SOURCES})
|
||||||
source_group(formula FILES ${FORUMULA_HEADERS} ${FORUMULA_SOURCES})
|
source_group(formula FILES ${FORUMULA_HEADERS} ${FORUMULA_SOURCES})
|
||||||
source_group(packaging FILES ${PACKAGING_HEADERS} ${PACKAGING_SOURCES})
|
source_group(packaging FILES ${PACKAGING_HEADERS} ${PACKAGING_SOURCES})
|
||||||
source_group(serialization FILES ${SERIALIZATION_HEADERS} ${SERIALIZATION_SOURCES})
|
source_group(serialization FILES ${SERIALIZATION_HEADERS} ${SERIALIZATION_SOURCES})
|
||||||
source_group(styles FILES ${STYLES_HEADERS} ${STYLES_SOURCES})
|
source_group(styles FILES ${STYLES_HEADERS} ${STYLES_SOURCES})
|
||||||
|
source_group(utils FILES ${UTILS_HEADERS} ${UTILS_SOURCES})
|
||||||
source_group(workbook FILES ${WORKBOOK_HEADERS} ${WORKBOOK_SOURCES})
|
source_group(workbook FILES ${WORKBOOK_HEADERS} ${WORKBOOK_SOURCES})
|
||||||
source_group(worksheet FILES ${WORKSHEET_HEADERS} ${WORKSHEET_SOURCES})
|
source_group(worksheet FILES ${WORKSHEET_HEADERS} ${WORKSHEET_SOURCES})
|
||||||
source_group(third-party FILES ../third-party/pugixml/src/pugixml.cpp ../third-party/miniz/miniz.c)
|
source_group(third-party\\miniz FILES ${MINIZ})
|
||||||
|
source_group(third-party\\pugixml FILES ${PUGIXML})
|
||||||
|
|
|
@ -2,28 +2,57 @@ project(xlnt.test)
|
||||||
|
|
||||||
include_directories(../include)
|
include_directories(../include)
|
||||||
include_directories(../source)
|
include_directories(../source)
|
||||||
include_directories(../third-party/pugixml/src)
|
include_directories(../tests)
|
||||||
include_directories(../third-party/cxxtest)
|
include_directories(../third-party/cxxtest)
|
||||||
|
include_directories(../third-party/pugixml/src)
|
||||||
|
|
||||||
|
FILE(GLOB CELL_TESTS ../source/cell/tests/test_*.hpp)
|
||||||
|
FILE(GLOB CHARTS_TESTS ../source/charts/tests/test_*.hpp)
|
||||||
|
FILE(GLOB CHARTSHEET_TESTS ../source/chartsheet/tests/test_*.hpp)
|
||||||
|
FILE(GLOB DRAWING_TESTS ../source/drawing/tests/test_*.hpp)
|
||||||
|
FILE(GLOB FORMULA_TESTS ../source/formula/tests/test_*.hpp)
|
||||||
|
FILE(GLOB PACKAGING_TESTS ../source/packaging/tests/test_*.hpp)
|
||||||
|
FILE(GLOB SERIALIZATION_TESTS ../source/serialization/tests/test_*.hpp)
|
||||||
|
FILE(GLOB STYLES_TESTS ../source/styles/tests/test_*.hpp)
|
||||||
|
FILE(GLOB UTILS_TESTS ../source/utils/tests/test_*.hpp)
|
||||||
|
FILE(GLOB WORKBOOK_TESTS ../source/workbook/tests/test_*.hpp)
|
||||||
|
FILE(GLOB WORKSHEET_TESTS ../source/worksheet/tests/test_*.hpp)
|
||||||
|
|
||||||
|
SET(TESTS ${CELL_TESTS} ${CHARTS_TESTS} ${CHARTSHEET_TESTS} ${DRAWING_TESTS} ${FORMULA_TESTS} ${PACKAGING_TESTS} ${SERIALIZATION_TESTS} ${STYLES_TESTS} ${UTILS_TESTS} ${WORKBOOK_TESTS} ${WORKSHEET_TESTS})
|
||||||
|
|
||||||
FILE(GLOB TEST_HEADERS ../tests/*.hpp)
|
|
||||||
FILE(GLOB TEST_HELPERS_HEADERS ../tests/helpers/*.hpp)
|
FILE(GLOB TEST_HELPERS_HEADERS ../tests/helpers/*.hpp)
|
||||||
FILE(GLOB TEST_HELPERS_SOURCES ../tests/helpers/*.cpp)
|
FILE(GLOB TEST_HELPERS_SOURCES ../tests/helpers/*.cpp)
|
||||||
|
|
||||||
add_executable(xlnt.test ../tests/runner-autogen.cpp ${TEST_HEADERS} ${TEST_HELPERS_HEADERS} ${TEST_HELPERS_SOURCES})
|
SET(TEST_HELPERS ${TEST_HELPERS_HEADERS} ${TEST_HELPERS_SOURCES})
|
||||||
|
|
||||||
source_group(runner FILES ../tests/runner-autogen.cpp)
|
SET(RUNNER ../tests/runner-autogen.cpp)
|
||||||
source_group(tests FILES ${TEST_HEADERS})
|
|
||||||
source_group(helpers FILES ${TEST_HELPERS_HEADERS} ${TEST_HELPERS_SOURCES})
|
add_executable(xlnt.test ${TEST_HELPERS} ${TESTS} ${RUNNER} )
|
||||||
|
|
||||||
|
source_group(helpers FILES ${TEST_HELPERS})
|
||||||
|
source_group(tests\\cell FILES ${CELL_TESTS})
|
||||||
|
source_group(tests\\charts FILES ${CHARTS_TESTS})
|
||||||
|
source_group(tests\\chartsheet FILES ${CHARTSHEET_TESTS})
|
||||||
|
source_group(tests\\drawing FILES ${DRAWING_TESTS})
|
||||||
|
source_group(tests\\formula FILES ${FORMULA_TESTS})
|
||||||
|
source_group(tests\\packaging FILES ${PACKAGING_TESTS})
|
||||||
|
source_group(tests\\serialization FILES ${SERIALIZATION_TESTS})
|
||||||
|
source_group(tests\\styles FILES ${STYLES_TESTS})
|
||||||
|
source_group(tests\\utils FILES ${UTILS_TESTS})
|
||||||
|
source_group(tests\\workbook FILES ${WORKBOOK_TESTS})
|
||||||
|
source_group(tests\\worksheet FILES ${WORKSHEET_TESTS})
|
||||||
|
source_group(runner FILES ${RUNNER})
|
||||||
|
|
||||||
target_link_libraries(xlnt.test xlnt)
|
target_link_libraries(xlnt.test xlnt)
|
||||||
|
|
||||||
|
# Needed for PathFileExists in path_helper (test helper)
|
||||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||||
target_link_libraries(xlnt.test Shlwapi)
|
target_link_libraries(xlnt.test Shlwapi)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_target (generate-test-runner
|
add_custom_target (generate-test-runner
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generate-tests
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generate-tests
|
||||||
COMMENT "Generating test runner tests/runner-autogen.cpp"
|
COMMENT "Generating test runner ${RUNNER}"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(xlnt.test generate-test-runner)
|
add_dependencies(xlnt.test generate-test-runner)
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <xlnt/common/types.hpp>
|
#include <xlnt/cell/types.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <xlnt/common/types.hpp>
|
#include <xlnt/cell/types.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <xlnt/common/zip_file.hpp>
|
#include <xlnt/packaging/zip_file.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
// @author: see AUTHORS file
|
// @author: see AUTHORS file
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <xlnt/common/hash_combine.hpp>
|
#include <xlnt/utils/hash_combine.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include "side.hpp"
|
#include <xlnt/utils/hash_combine.hpp>
|
||||||
#include "../common/hash_combine.hpp"
|
#include <xlnt/styles/side.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <xlnt/common/hash_combine.hpp>
|
#include <xlnt/utils/hash_combine.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
// @author: see AUTHORS file
|
// @author: see AUTHORS file
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../common/hash_combine.hpp"
|
#include <xlnt/styles/color.hpp>
|
||||||
#include "../styles/color.hpp"
|
#include <xlnt/utils/hash_combine.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <xlnt/common/hash_combine.hpp>
|
#include <xlnt/utils/hash_combine.hpp>
|
||||||
#include <xlnt/styles/color.hpp>
|
#include <xlnt/styles/color.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#include <xlnt/common/hash_combine.hpp>
|
#include <xlnt/utils/hash_combine.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <xlnt/common/types.hpp>
|
#include <xlnt/cell/types.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <xlnt/common/datetime.hpp>
|
#include <xlnt/utils/datetime.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <xlnt/common/relationship.hpp>
|
#include <xlnt/packaging/relationship.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <xlnt/common/types.hpp>
|
#include <xlnt/cell/types.hpp>
|
||||||
#include <xlnt/common/relationship.hpp>
|
#include <xlnt/packaging/relationship.hpp>
|
||||||
#include <xlnt/worksheet/page_setup.hpp>
|
#include <xlnt/worksheet/page_setup.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
|
@ -38,12 +38,10 @@ const std::string download_url = "https://github.com/tfussell/xlnt/archive/maste
|
||||||
#include <xlnt/cell/cell.hpp>
|
#include <xlnt/cell/cell.hpp>
|
||||||
#include <xlnt/cell/cell_reference.hpp>
|
#include <xlnt/cell/cell_reference.hpp>
|
||||||
#include <xlnt/cell/comment.hpp>
|
#include <xlnt/cell/comment.hpp>
|
||||||
#include <xlnt/common/datetime.hpp>
|
#include <xlnt/cell/types.hpp>
|
||||||
#include <xlnt/common/encoding.hpp>
|
#include <xlnt/packaging/relationship.hpp>
|
||||||
#include <xlnt/common/exceptions.hpp>
|
#include <xlnt/packaging/zip_file.hpp>
|
||||||
#include <xlnt/common/relationship.hpp>
|
#include <xlnt/serialization/encoding.hpp>
|
||||||
#include <xlnt/common/types.hpp>
|
|
||||||
#include <xlnt/common/zip_file.hpp>
|
|
||||||
#include <xlnt/styles/alignment.hpp>
|
#include <xlnt/styles/alignment.hpp>
|
||||||
#include <xlnt/styles/border.hpp>
|
#include <xlnt/styles/border.hpp>
|
||||||
#include <xlnt/styles/color.hpp>
|
#include <xlnt/styles/color.hpp>
|
||||||
|
@ -54,6 +52,8 @@ const std::string download_url = "https://github.com/tfussell/xlnt/archive/maste
|
||||||
#include <xlnt/styles/protection.hpp>
|
#include <xlnt/styles/protection.hpp>
|
||||||
#include <xlnt/styles/side.hpp>
|
#include <xlnt/styles/side.hpp>
|
||||||
#include <xlnt/styles/style.hpp>
|
#include <xlnt/styles/style.hpp>
|
||||||
|
#include <xlnt/utils/datetime.hpp>
|
||||||
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/workbook/document_properties.hpp>
|
#include <xlnt/workbook/document_properties.hpp>
|
||||||
#include <xlnt/workbook/document_security.hpp>
|
#include <xlnt/workbook/document_security.hpp>
|
||||||
#include <xlnt/workbook/external_book.hpp>
|
#include <xlnt/workbook/external_book.hpp>
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
#include <xlnt/cell/cell.hpp>
|
#include <xlnt/cell/cell.hpp>
|
||||||
#include <xlnt/cell/cell_reference.hpp>
|
#include <xlnt/cell/cell_reference.hpp>
|
||||||
#include <xlnt/cell/comment.hpp>
|
#include <xlnt/cell/comment.hpp>
|
||||||
#include <xlnt/common/datetime.hpp>
|
#include <xlnt/packaging/relationship.hpp>
|
||||||
#include <xlnt/common/exceptions.hpp>
|
#include <xlnt/styles/color.hpp>
|
||||||
#include <xlnt/common/relationship.hpp>
|
#include <xlnt/utils/datetime.hpp>
|
||||||
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/workbook/workbook.hpp>
|
#include <xlnt/workbook/workbook.hpp>
|
||||||
#include <xlnt/workbook/document_properties.hpp>
|
#include <xlnt/workbook/document_properties.hpp>
|
||||||
#include <xlnt/worksheet/column_properties.hpp>
|
#include <xlnt/worksheet/column_properties.hpp>
|
||||||
#include <xlnt/worksheet/row_properties.hpp>
|
#include <xlnt/worksheet/row_properties.hpp>
|
||||||
#include <xlnt/worksheet/worksheet.hpp>
|
#include <xlnt/worksheet/worksheet.hpp>
|
||||||
#include <xlnt/styles/color.hpp>
|
|
||||||
|
|
||||||
#include <detail/cell_impl.hpp>
|
#include <detail/cell_impl.hpp>
|
||||||
#include <detail/comment_impl.hpp>
|
#include <detail/comment_impl.hpp>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
|
||||||
#include <xlnt/cell/cell_reference.hpp>
|
#include <xlnt/cell/cell_reference.hpp>
|
||||||
#include <xlnt/common/exceptions.hpp>
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/worksheet/range_reference.hpp>
|
#include <xlnt/worksheet/range_reference.hpp>
|
||||||
|
|
||||||
#include "detail/constants.hpp"
|
#include <detail/constants.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
#include <xlnt/cell/cell.hpp>
|
#include <xlnt/cell/cell.hpp>
|
||||||
#include <xlnt/cell/cell_reference.hpp>
|
#include <xlnt/cell/cell_reference.hpp>
|
||||||
#include <xlnt/cell/comment.hpp>
|
#include <xlnt/cell/comment.hpp>
|
||||||
#include <xlnt/common/datetime.hpp>
|
|
||||||
#include <xlnt/common/exceptions.hpp>
|
|
||||||
#include <xlnt/styles/alignment.hpp>
|
#include <xlnt/styles/alignment.hpp>
|
||||||
#include <xlnt/styles/border.hpp>
|
#include <xlnt/styles/border.hpp>
|
||||||
#include <xlnt/styles/font.hpp>
|
#include <xlnt/styles/font.hpp>
|
||||||
#include <xlnt/styles/fill.hpp>
|
#include <xlnt/styles/fill.hpp>
|
||||||
#include <xlnt/styles/number_format.hpp>
|
#include <xlnt/styles/number_format.hpp>
|
||||||
#include <xlnt/styles/protection.hpp>
|
#include <xlnt/styles/protection.hpp>
|
||||||
|
#include <xlnt/utils/datetime.hpp>
|
||||||
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/worksheet/range.hpp>
|
#include <xlnt/worksheet/range.hpp>
|
||||||
#include <xlnt/worksheet/worksheet.hpp>
|
#include <xlnt/worksheet/worksheet.hpp>
|
||||||
#include <xlnt/workbook/workbook.hpp>
|
#include <xlnt/workbook/workbook.hpp>
|
|
@ -4,10 +4,10 @@
|
||||||
|
|
||||||
#include <xlnt/cell/cell.hpp>
|
#include <xlnt/cell/cell.hpp>
|
||||||
#include <xlnt/cell/comment.hpp>
|
#include <xlnt/cell/comment.hpp>
|
||||||
#include <xlnt/common/exceptions.hpp>
|
#include <xlnt/cell/types.hpp>
|
||||||
#include <xlnt/common/datetime.hpp>
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/common/types.hpp>
|
#include <xlnt/utils/datetime.hpp>
|
||||||
#include <xlnt/common/relationship.hpp>
|
#include <xlnt/packaging/relationship.hpp>
|
||||||
#include <xlnt/styles/number_format.hpp>
|
#include <xlnt/styles/number_format.hpp>
|
||||||
|
|
||||||
#include "comment_impl.hpp"
|
#include "comment_impl.hpp"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include <xlnt/common/types.hpp>
|
#include <xlnt/cell/types.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include <xlnt/common/relationship.hpp>
|
#include <xlnt/packaging/relationship.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include <xlnt/serialization/workbook_serializer.hpp>
|
#include <xlnt/serialization/workbook_serializer.hpp>
|
||||||
#include <xlnt/serialization/xml_document.hpp>
|
#include <xlnt/serialization/xml_document.hpp>
|
||||||
|
|
||||||
#include "helpers/path_helper.hpp"
|
#include <helpers/path_helper.hpp>
|
||||||
#include "helpers/helper.hpp"
|
#include <helpers/helper.hpp>
|
||||||
|
|
||||||
class test_props : public CxxTest::TestSuite
|
class test_props : public CxxTest::TestSuite
|
||||||
{
|
{
|
|
@ -7,7 +7,7 @@
|
||||||
#include <miniz.h>
|
#include <miniz.h>
|
||||||
|
|
||||||
#include <detail/include_windows.hpp>
|
#include <detail/include_windows.hpp>
|
||||||
#include <xlnt/common/zip_file.hpp>
|
#include <xlnt/packaging/zip_file.hpp>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
#include <xlnt/serialization/excel_serializer.hpp>
|
#include <xlnt/serialization/excel_serializer.hpp>
|
||||||
#include <xlnt/common/exceptions.hpp>
|
|
||||||
#include <xlnt/serialization/manifest_serializer.hpp>
|
#include <xlnt/serialization/manifest_serializer.hpp>
|
||||||
#include <xlnt/serialization/relationship_serializer.hpp>
|
#include <xlnt/serialization/relationship_serializer.hpp>
|
||||||
#include <xlnt/serialization/shared_strings_serializer.hpp>
|
#include <xlnt/serialization/shared_strings_serializer.hpp>
|
||||||
|
@ -13,6 +12,7 @@
|
||||||
#include <xlnt/serialization/xml_document.hpp>
|
#include <xlnt/serialization/xml_document.hpp>
|
||||||
#include <xlnt/serialization/xml_node.hpp>
|
#include <xlnt/serialization/xml_node.hpp>
|
||||||
#include <xlnt/serialization/xml_serializer.hpp>
|
#include <xlnt/serialization/xml_serializer.hpp>
|
||||||
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/workbook/document_properties.hpp>
|
#include <xlnt/workbook/document_properties.hpp>
|
||||||
#include <xlnt/workbook/manifest.hpp>
|
#include <xlnt/workbook/manifest.hpp>
|
||||||
#include <xlnt/workbook/workbook.hpp>
|
#include <xlnt/workbook/workbook.hpp>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <xlnt/serialization/relationship_serializer.hpp>
|
#include <xlnt/serialization/relationship_serializer.hpp>
|
||||||
|
|
||||||
#include <xlnt/common/relationship.hpp>
|
#include <xlnt/packaging/relationship.hpp>
|
||||||
#include <xlnt/common/zip_file.hpp>
|
#include <xlnt/packaging/zip_file.hpp>
|
||||||
#include <xlnt/serialization/xml_document.hpp>
|
#include <xlnt/serialization/xml_document.hpp>
|
||||||
#include <xlnt/serialization/xml_node.hpp>
|
#include <xlnt/serialization/xml_node.hpp>
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cxxtest/TestSuite.h>
|
#include <cxxtest/TestSuite.h>
|
||||||
|
|
||||||
#include <xlnt/common/exceptions.hpp>
|
|
||||||
#include <xlnt/serialization/workbook_serializer.hpp>
|
#include <xlnt/serialization/workbook_serializer.hpp>
|
||||||
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
|
|
||||||
#include "helpers/path_helper.hpp"
|
#include <helpers/path_helper.hpp>
|
||||||
|
|
||||||
class test_write_workbook : public CxxTest::TestSuite
|
class test_write_workbook : public CxxTest::TestSuite
|
||||||
{
|
{
|
|
@ -1,11 +1,11 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <xlnt/packaging/relationship.hpp>
|
||||||
#include <xlnt/serialization/workbook_serializer.hpp>
|
#include <xlnt/serialization/workbook_serializer.hpp>
|
||||||
#include <xlnt/common/datetime.hpp>
|
|
||||||
#include <xlnt/common/exceptions.hpp>
|
|
||||||
#include <xlnt/common/relationship.hpp>
|
|
||||||
#include <xlnt/serialization/xml_document.hpp>
|
#include <xlnt/serialization/xml_document.hpp>
|
||||||
#include <xlnt/serialization/xml_node.hpp>
|
#include <xlnt/serialization/xml_node.hpp>
|
||||||
|
#include <xlnt/utils/datetime.hpp>
|
||||||
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/workbook/document_properties.hpp>
|
#include <xlnt/workbook/document_properties.hpp>
|
||||||
#include <xlnt/workbook/manifest.hpp>
|
#include <xlnt/workbook/manifest.hpp>
|
||||||
#include <xlnt/workbook/named_range.hpp>
|
#include <xlnt/workbook/named_range.hpp>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
#include <xlnt/worksheet/range_reference.hpp>
|
#include <xlnt/worksheet/range_reference.hpp>
|
||||||
#include <xlnt/worksheet/worksheet.hpp>
|
#include <xlnt/worksheet/worksheet.hpp>
|
||||||
|
|
||||||
#include "detail/constants.hpp"
|
#include <detail/constants.hpp>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
#include <xlnt/common/hash_combine.hpp>
|
#include <xlnt/utils/hash_combine.hpp>
|
||||||
#include <xlnt/styles/number_format.hpp>
|
#include <xlnt/styles/number_format.hpp>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#include <xlnt/common/datetime.hpp>
|
#include <xlnt/utils/datetime.hpp>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -36,14 +36,18 @@ time time::from_number(long double raw_time)
|
||||||
result.second = (int)fractional_part;
|
result.second = (int)fractional_part;
|
||||||
fractional_part = 1000000 * (fractional_part - result.second);
|
fractional_part = 1000000 * (fractional_part - result.second);
|
||||||
result.microsecond = (int)fractional_part;
|
result.microsecond = (int)fractional_part;
|
||||||
|
|
||||||
if (result.microsecond == 999999 && fractional_part - result.microsecond > 0.5)
|
if (result.microsecond == 999999 && fractional_part - result.microsecond > 0.5)
|
||||||
{
|
{
|
||||||
result.microsecond = 0;
|
result.microsecond = 0;
|
||||||
result.second += 1;
|
result.second += 1;
|
||||||
|
|
||||||
if (result.second == 60)
|
if (result.second == 60)
|
||||||
{
|
{
|
||||||
result.second = 0;
|
result.second = 0;
|
||||||
result.minute += 1;
|
result.minute += 1;
|
||||||
|
|
||||||
|
//TODO: too much nesting
|
||||||
if (result.minute == 60)
|
if (result.minute == 60)
|
||||||
{
|
{
|
||||||
result.minute = 0;
|
result.minute = 0;
|
||||||
|
@ -51,6 +55,7 @@ time time::from_number(long double raw_time)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +97,7 @@ datetime datetime::from_number(long double raw_time, calendar base_date)
|
||||||
{
|
{
|
||||||
auto date_part = date::from_number((int)raw_time, base_date);
|
auto date_part = date::from_number((int)raw_time, base_date);
|
||||||
auto time_part = time::from_number(raw_time);
|
auto time_part = time::from_number(raw_time);
|
||||||
|
|
||||||
return datetime(date_part.year, date_part.month, date_part.day, time_part.hour, time_part.minute, time_part.second,
|
return datetime(date_part.year, date_part.month, date_part.day, time_part.hour, time_part.minute, time_part.second,
|
||||||
time_part.microsecond);
|
time_part.microsecond);
|
||||||
}
|
}
|
||||||
|
@ -122,6 +128,7 @@ time::time(const std::string &time_string) : hour(0), minute(0), second(0), micr
|
||||||
colon_index = remaining.find(':');
|
colon_index = remaining.find(':');
|
||||||
minute = std::stoi(remaining.substr(0, colon_index));
|
minute = std::stoi(remaining.substr(0, colon_index));
|
||||||
colon_index = remaining.find(':');
|
colon_index = remaining.find(':');
|
||||||
|
|
||||||
if (colon_index != std::string::npos)
|
if (colon_index != std::string::npos)
|
||||||
{
|
{
|
||||||
remaining = remaining.substr(colon_index + 1);
|
remaining = remaining.substr(colon_index + 1);
|
||||||
|
@ -139,6 +146,7 @@ long double time::to_number() const
|
||||||
auto number = microseconds / (24.0L * microseconds_per_hour);
|
auto number = microseconds / (24.0L * microseconds_per_hour);
|
||||||
auto hundred_billion = static_cast<std::uint64_t>(1e9) * 100;
|
auto hundred_billion = static_cast<std::uint64_t>(1e9) * 100;
|
||||||
number = std::floor(number * hundred_billion + 0.5L) / hundred_billion;
|
number = std::floor(number * hundred_billion + 0.5L) / hundred_billion;
|
||||||
|
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include <xlnt/common/exceptions.hpp>
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/workbook/named_range.hpp>
|
#include <xlnt/workbook/named_range.hpp>
|
||||||
#include <xlnt/common/exceptions.hpp>
|
|
||||||
#include <xlnt/worksheet/range_reference.hpp>
|
#include <xlnt/worksheet/range_reference.hpp>
|
||||||
#include <xlnt/worksheet/worksheet.hpp>
|
#include <xlnt/worksheet/worksheet.hpp>
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <xlnt/common/exceptions.hpp>
|
|
||||||
#include <xlnt/common/relationship.hpp>
|
|
||||||
#include <xlnt/common/zip_file.hpp>
|
|
||||||
#include <xlnt/drawing/drawing.hpp>
|
#include <xlnt/drawing/drawing.hpp>
|
||||||
|
#include <xlnt/packaging/relationship.hpp>
|
||||||
|
#include <xlnt/packaging/zip_file.hpp>
|
||||||
#include <xlnt/serialization/excel_serializer.hpp>
|
#include <xlnt/serialization/excel_serializer.hpp>
|
||||||
#include <xlnt/styles/alignment.hpp>
|
#include <xlnt/styles/alignment.hpp>
|
||||||
#include <xlnt/styles/border.hpp>
|
#include <xlnt/styles/border.hpp>
|
||||||
|
@ -16,6 +15,7 @@
|
||||||
#include <xlnt/styles/number_format.hpp>
|
#include <xlnt/styles/number_format.hpp>
|
||||||
#include <xlnt/styles/protection.hpp>
|
#include <xlnt/styles/protection.hpp>
|
||||||
#include <xlnt/styles/style.hpp>
|
#include <xlnt/styles/style.hpp>
|
||||||
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/workbook/document_properties.hpp>
|
#include <xlnt/workbook/document_properties.hpp>
|
||||||
#include <xlnt/workbook/manifest.hpp>
|
#include <xlnt/workbook/manifest.hpp>
|
||||||
#include <xlnt/workbook/named_range.hpp>
|
#include <xlnt/workbook/named_range.hpp>
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
|
|
||||||
#include <xlnt/cell/cell.hpp>
|
#include <xlnt/cell/cell.hpp>
|
||||||
#include <xlnt/cell/cell_reference.hpp>
|
#include <xlnt/cell/cell_reference.hpp>
|
||||||
#include <xlnt/common/datetime.hpp>
|
#include <xlnt/cell/types.hpp>
|
||||||
#include <xlnt/common/exceptions.hpp>
|
#include <xlnt/packaging/relationship.hpp>
|
||||||
#include <xlnt/common/relationship.hpp>
|
#include <xlnt/utils/datetime.hpp>
|
||||||
#include <xlnt/common/types.hpp>
|
#include <xlnt/utils/exceptions.hpp>
|
||||||
#include <xlnt/workbook/named_range.hpp>
|
#include <xlnt/workbook/named_range.hpp>
|
||||||
#include <xlnt/workbook/workbook.hpp>
|
#include <xlnt/workbook/workbook.hpp>
|
||||||
#include <xlnt/worksheet/range.hpp>
|
#include <xlnt/worksheet/range.hpp>
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <detail/include_windows.hpp>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#elif defined(_WIN32)
|
#elif defined(_MSC_VER)
|
||||||
#define NOMINMAX
|
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
#include <Windows.h>
|
#elif defined(__linux)
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/limits.h>
|
#include <linux/limits.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
|
|
||||||
throw std::runtime_error("buffer too small, " + std::to_string(path.size()) + ", should be: " + std::to_string(size));
|
throw std::runtime_error("buffer too small, " + std::to_string(path.size()) + ", should be: " + std::to_string(size));
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
std::array<TCHAR, MAX_PATH> buffer;
|
std::array<TCHAR, MAX_PATH> buffer;
|
||||||
DWORD result = GetModuleFileName(nullptr, buffer.data(), (DWORD)buffer.size());
|
DWORD result = GetModuleFileName(nullptr, buffer.data(), (DWORD)buffer.size());
|
||||||
|
@ -113,14 +113,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool FileExists(const std::string &path)
|
static bool FileExists(const std::string &path)
|
||||||
{
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
#ifdef _WIN32
|
|
||||||
|
|
||||||
std::wstring path_wide(path.begin(), path.end());
|
std::wstring path_wide(path.begin(), path.end());
|
||||||
return PathFileExists(path_wide.c_str()) && !PathIsDirectory(path_wide.c_str());
|
return PathFileExists(path_wide.c_str()) && !PathIsDirectory(path_wide.c_str());
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
struct stat fileAtt;
|
struct stat fileAtt;
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cxxtest/TestSuite.h>
|
|
||||||
|
|
||||||
#include <xlnt/xlnt.hpp>
|
|
||||||
|
|
||||||
class test_meta : public CxxTest::TestSuite
|
|
||||||
{
|
|
||||||
};
|
|
|
@ -1,60 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <cxxtest/TestSuite.h>
|
|
||||||
|
|
||||||
#include <xlnt/xlnt.hpp>
|
|
||||||
|
|
||||||
class test_strings : public CxxTest::TestSuite
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
test_strings()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_create_string_table()
|
|
||||||
{
|
|
||||||
/*wb = Workbook()
|
|
||||||
ws = wb.create_sheet()
|
|
||||||
ws.cell("B12").value = "hello"
|
|
||||||
ws.cell("B13").value = "world"
|
|
||||||
ws.cell("D28").value = "hello"
|
|
||||||
table = create_string_table(wb)
|
|
||||||
TS_ASSERT_EQUALS({"hello": 1, "world" : 0}, table)*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_read_string_table()
|
|
||||||
{
|
|
||||||
/*handle = open(os.path.join(DATADIR, "reader", "sharedStrings.xml"))
|
|
||||||
try :
|
|
||||||
content = handle.read()
|
|
||||||
string_table = read_string_table(content)
|
|
||||||
TS_ASSERT_EQUALS({0: "This is cell A1 in Sheet 1", 1 : "This is cell G5"}, string_table)
|
|
||||||
finally :
|
|
||||||
handle.close()*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_empty_string()
|
|
||||||
{
|
|
||||||
/*handle = open(os.path.join(DATADIR, "reader", "sharedStrings-emptystring.xml"))
|
|
||||||
try :
|
|
||||||
content = handle.read()
|
|
||||||
string_table = read_string_table(content)
|
|
||||||
TS_ASSERT_EQUALS({0: "Testing empty cell", 1 : ""}, string_table)
|
|
||||||
finally :
|
|
||||||
handle.close()*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_formatted_string_table()
|
|
||||||
{
|
|
||||||
/*handle = open(os.path.join(DATADIR, "reader", "shared-strings-rich.xml"))
|
|
||||||
try :
|
|
||||||
content = handle.read()
|
|
||||||
string_table = read_string_table(content)
|
|
||||||
TS_ASSERT_EQUALS({0: "Welcome", 1 : "to the best shop in town",
|
|
||||||
2 : " let"s play "}, string_table)
|
|
||||||
finally :
|
|
||||||
handle.close()*/
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user