|
| 1 | +// The MIT License (MIT) |
| 2 | +// |
| 3 | +// Copyright (c) 2019 Darrell Wright |
| 4 | +// |
| 5 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | +// of this software and associated documentation files( the "Software" ), to |
| 7 | +// deal in the Software without restriction, including without limitation the |
| 8 | +// rights to use, copy, modify, merge, publish, distribute, sublicense, and / or |
| 9 | +// sell copies of the Software, and to permit persons to whom the Software is |
| 10 | +// furnished to do so, subject to the following conditions: |
| 11 | +// |
| 12 | +// The above copyright notice and this permission notice shall be included in |
| 13 | +// all copies or substantial portions of the Software. |
| 14 | +// |
| 15 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE |
| 18 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | +// SOFTWARE. |
| 22 | + |
| 23 | +#pragma once |
| 24 | + |
| 25 | +#include <iostream> |
| 26 | +#include <string> |
| 27 | +#include <vector> |
| 28 | + |
| 29 | +namespace daw::json_to_cpp { |
| 30 | + struct config_t final { |
| 31 | + bool enable_jsonlink = true; |
| 32 | + std::ostream *header_stream = nullptr; |
| 33 | + std::ostream *cpp_stream = nullptr; |
| 34 | + std::string root_object_name; |
| 35 | + std::string type_prefix{}; |
| 36 | + std::string type_suffix{}; |
| 37 | + std::optional<std::string> path{}; |
| 38 | + boost::filesystem::path cpp_path; |
| 39 | + boost::filesystem::path json_path; |
| 40 | + std::vector<std::vector<std::string>> kv_paths; |
| 41 | + bool hide_null_only; |
| 42 | + bool use_string_view; |
| 43 | + bool has_cpp20; |
| 44 | + |
| 45 | + std::ostream &header_file( ); |
| 46 | + std::ostream &cpp_file( ); |
| 47 | + |
| 48 | + inline bool path_matches( std::vector<std::string> const &cur_path ) const { |
| 49 | + for( auto const &kv_path : kv_paths ) { |
| 50 | + if( kv_path == cur_path ) { |
| 51 | + return true; |
| 52 | + } |
| 53 | + } |
| 54 | + return false; |
| 55 | + } |
| 56 | + }; |
| 57 | +} // namespace daw::json_to_cpp |
0 commit comments