Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
cmake_minimum_required(VERSION 2.8.4)
project(goodform)

include_directories("./include")
include_directories("${CMAKE_CURRENT_LIST_DIR}/include")

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

#set(CMAKE_CXX_COMPILER "/opt/local/bin/g++-mp-4.9")
#set(CMAKE_CC_COMPILER "/opt/local/bin/gcc-mp-4.9")
# set(CMAKE_CXX_COMPILER "/opt/local/bin/g++-mp-4.9")
# set(CMAKE_CC_COMPILER "/opt/local/bin/gcc-mp-4.9")

set(HEADER_FILES
include/form.hpp
include/variant.hpp
include/msgpack.hpp
include/json.hpp
include/portable_endian.hpp)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")

set(SOURCE_FILES
src/variant.cpp
src/msgpack.cpp
src/json.cpp)

add_library(goodform SHARED ${SOURCE_FILES} ${HEADER_FILES})
add_library(goodform SHARED ${SOURCE_FILES})

add_library(goodform-static STATIC ${SOURCE_FILES})

add_library(goodform-static STATIC ${SOURCE_FILES} ${HEADER_FILES})
add_executable(variant-test tests/variant-test.cpp ${SOURCE_FILES})

add_executable(variant-test tests/variant-test.cpp ${SOURCE_FILES} ${HEADER_FILES})
target_include_directories(goodform PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
16 changes: 8 additions & 8 deletions include/form.hpp → include/goodform/form.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ namespace goodform
class number_validator
{
private:
error_message& error_;
const N value_;
error_message& error_;
public:
number_validator(N value, error_message& error_message);
number_validator(const number_validator& source);
Expand Down Expand Up @@ -89,8 +89,8 @@ namespace goodform
class string_validator
{
private:
error_message& error_;
const std::string& value_;
error_message& error_;
public:
string_validator(const std::string& value, error_message& error_message);

Expand Down Expand Up @@ -187,11 +187,11 @@ namespace goodform
//======================================================================//
class sub_form
{
protected:
const variant& variant_;
private:
error_message& error_;
//static double convert_to_double(const variant& v);
protected:
const variant& variant_;
public:
sub_form(const variant& v, error_message& error_message);
sub_form(const sub_form& source);
Expand Down Expand Up @@ -558,7 +558,7 @@ namespace goodform
//======================================================================//

//======================================================================//
array_validator::array_validator(const std::vector<variant>& value, error_message& errorMessage) : value_(value), error_(errorMessage)
array_validator::array_validator(const std::vector<variant>& value, error_message& errorMessage) : error_(errorMessage), value_(value)
{

}
Expand Down Expand Up @@ -602,7 +602,7 @@ namespace goodform
//======================================================================//

//======================================================================//
object_validator::object_validator(const std::map<std::string,variant>& value, error_message& errorMessage) : value_(value), error_(errorMessage)
object_validator::object_validator(const std::map<std::string,variant>& value, error_message& errorMessage) : error_(errorMessage), value_(value)
{

}
Expand Down Expand Up @@ -1012,7 +1012,7 @@ namespace goodform
//======================================================================//

//======================================================================//
form::form(const variant& v) : error_(""), sub_form(v, error_)
form::form(const variant& v) : sub_form(v, error_), error_("")
{

}
Expand All @@ -1024,4 +1024,4 @@ namespace goodform
//======================================================================//
}
//######################################################################//
#endif //GOODFORM_FORM_HPP
#endif //GOODFORM_FORM_HPP
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions include/variant.hpp → include/goodform/variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace goodform
//----------------------------------------------------------------------//

//----------------------------------------------------------------------//
variant& operator=(std::nullptr_t value);
variant& operator=(std::nullptr_t value [[maybe_unused]]);
variant& operator=(bool value);

variant& operator=(std::int8_t value);
Expand Down Expand Up @@ -206,4 +206,4 @@ namespace goodform
//======================================================================//
}
//######################################################################//
#endif //GOODFORM_VARIANT_HPP
#endif //GOODFORM_VARIANT_HPP
2 changes: 1 addition & 1 deletion src/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <codecvt>
#include <locale>

#include "json.hpp"
#include "goodform/json.hpp"

//######################################################################//
namespace goodform
Expand Down
6 changes: 3 additions & 3 deletions src/msgpack.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "msgpack.hpp"
#include "portable_endian.hpp"
#include "goodform/msgpack.hpp"
#include "goodform/portable_endian.hpp"

namespace goodform
{
Expand Down Expand Up @@ -589,4 +589,4 @@ namespace goodform
return ret;
}
//----------------------------------------------------------------//
}
}
6 changes: 3 additions & 3 deletions src/variant.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include "variant.hpp"
#include "goodform/variant.hpp"

#include <assert.h>

Expand Down Expand Up @@ -161,7 +161,7 @@ namespace goodform
//----------------------------------------------------------------------//

//----------------------------------------------------------------------//
variant::variant(std::nullptr_t value)
variant::variant(std::nullptr_t value [[maybe_unused]] )
{
this->type_ = variant_type::null;
}
Expand Down Expand Up @@ -358,7 +358,7 @@ namespace goodform
//----------------------------------------------------------------------//

//----------------------------------------------------------------------//
variant& variant::operator=(std::nullptr_t value)
variant& variant::operator=(std::nullptr_t value [[maybe_unused]])
{
this->destroy();
this->type_ = variant_type::null;
Expand Down
12 changes: 6 additions & 6 deletions tests/variant-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#include <limits>
#include <list>

#include "variant.hpp"
#include "form.hpp"
#include "msgpack.hpp"
#include "json.hpp"
#include "goodform/variant.hpp"
#include "goodform/form.hpp"
#include "goodform/msgpack.hpp"
#include "goodform/json.hpp"

#include <cmath>


int main(int argc, char** argv)
int main(int argc [[maybe_unused]], char** argv [[maybe_unused]])
{
{
bool passed = false;
Expand Down Expand Up @@ -106,4 +106,4 @@ int main(int argc, char** argv)


return 0;
}
}