/** * src/config/config.h * * Copyright (c) 2021-2022 Bartek Kryza * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include "class_diagram/model/diagram.h" #include "common/model/enums.h" #include "util/util.h" #include #include #include #include #include #include #include #include namespace clanguml { namespace config { struct plantuml { std::vector before; std::vector after; }; struct filter { std::vector namespaces; // Valid values are: // - inheritance // - dependency // - instantiation std::vector relationships; // E.g.: // - classes // - enums std::vector entity_types; // E.g.: // - public // - private std::vector scopes; }; enum class diagram_type { class_diagram, sequence_diagram, package_diagram }; std::string to_string(const diagram_type t); struct diagram { virtual ~diagram() = default; virtual diagram_type type() const = 0; std::string name; std::vector glob; std::vector using_namespace; filter include; filter exclude; plantuml puml; bool should_include_entities(const std::string &ent); bool should_include_relationship(const std::string &rel); bool should_include(const std::string &name_) const; bool should_include(const common::model::scope_t scope) const; }; struct source_location { enum class location_t { usr, marker, fileline, function }; location_t location_type; std::string location; }; struct class_diagram : public diagram { virtual ~class_diagram() = default; diagram_type type() const override; std::vector classes; bool include_relations_also_as_members{true}; bool has_class(std::string clazz); }; struct sequence_diagram : public diagram { virtual ~sequence_diagram() = default; diagram_type type() const override; std::vector start_from; }; struct package_diagram : public diagram { virtual ~package_diagram() = default; diagram_type type() const override; }; struct config { // the glob list is additive and relative to the current // directory std::vector glob; std::string compilation_database_dir{"."}; std::string output_directory{}; std::map> diagrams; }; config load(const std::string &config_file); } }