RigsofRods
Soft-body Physics Simulation
RigDef_Validator.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5  Copyright 2013-2020 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
34 #pragma once
35 
36 #include "RigDef_File.h"
37 
38 #include <memory>
39 #include <OgreString.h>
40 
41 namespace RigDef
42 {
43 
47 class Validator
48 {
49 public:
50 
51  struct Message // TODO: remove, use console API directly
52  {
53  enum Type
54  {
59 
60  TYPE_INVALID = 0xFFFFFFFF
61  };
62  };
63 
68 
73  bool AddModule(Ogre::String const & module_name);
74 
75  bool Validate();
76 
77  void SetCheckBeams(bool check_beams)
78  {
79  m_check_beams = check_beams;
80  }
81 
82 private:
83 
88 
92  bool CheckGearbox();
93 
94  void AddMessage(Validator::Message::Type type, Ogre::String const & text);
95 
96 /* -------------------------------------------------------------------------- */
97 /* Individual section checkers. */
98 /* -------------------------------------------------------------------------- */
99 
100  bool CheckShock2(RigDef::Shock2 & shock2);
101 
102  bool CheckShock3(RigDef::Shock3 & shock3);
103 
104  bool CheckAnimator(RigDef::Animator & def);
105 
106  bool CheckCommand(RigDef::Command2 & def);
107 
108  bool CheckTrigger(RigDef::Trigger & def);
109 
114 
115  bool CheckFlare2(RigDef::Flare2 & def);
116 
117 /* -------------------------------------------------------------------------- */
118 /* Properties */
119 /* -------------------------------------------------------------------------- */
120 
122  std::list<std::shared_ptr<RigDef::Document::Module>> m_selected_modules;
124 
125 };
126 
127 } // namespace RigDef
RigDef::Validator::CheckShock2
bool CheckShock2(RigDef::Shock2 &shock2)
Definition: RigDef_Validator.cpp:177
RigDef::Validator::Message::TYPE_ERROR
@ TYPE_ERROR
Definition: RigDef_Validator.h:57
RigDef::Validator::m_check_beams
bool m_check_beams
Definition: RigDef_Validator.h:123
RigDef::Validator::Message
Definition: RigDef_Validator.h:51
RigDef::Validator::CheckFlare2
bool CheckFlare2(RigDef::Flare2 &def)
Definition: RigDef_Validator.cpp:369
RigDef::Validator::Message::Type
Type
Definition: RigDef_Validator.h:53
file
This is a raw Ogre binding for Imgui No project cmake file
Definition: README-OgreImGui.txt:3
RigDef::Validator::CheckVideoCamera
bool CheckVideoCamera(RigDef::VideoCamera &def)
Section 'videocamera'.
Definition: RigDef_Validator.cpp:454
RigDef::Validator::CheckTrigger
bool CheckTrigger(RigDef::Trigger &def)
Definition: RigDef_Validator.cpp:392
RigDef::Validator::m_selected_modules
std::list< std::shared_ptr< RigDef::Document::Module > > m_selected_modules
Definition: RigDef_Validator.h:122
RigDef::Flare2
Definition: RigDef_File.h:870
RigDef::Trigger
Definition: RigDef_File.h:1363
RigDef::Validator::CheckCommand
bool CheckCommand(RigDef::Command2 &def)
Definition: RigDef_Validator.cpp:342
RigDef::Validator::Message::TYPE_WARNING
@ TYPE_WARNING
Definition: RigDef_Validator.h:56
RigDef::Validator::Setup
void Setup(RigDef::DocumentPtr file)
Prepares the validation.
Definition: RigDef_Validator.cpp:85
RigDef::Command2
Definition: RigDef_File.h:757
RigDef::Validator::CheckShock3
bool CheckShock3(RigDef::Shock3 &shock3)
Definition: RigDef_Validator.cpp:246
RigDef::Validator::CheckSectionSubmeshGroundmodel
bool CheckSectionSubmeshGroundmodel()
Inline-ection 'submesh_groundmodel', unique across all modules.
Definition: RigDef_Validator.cpp:114
RigDef::Shock2
Definition: RigDef_File.h:1192
RigDef::Validator
Performs a formal validation of the file (missing required parts, conflicts of modules,...
Definition: RigDef_Validator.h:47
RigDef::Validator::AddMessage
void AddMessage(Validator::Message::Type type, Ogre::String const &text)
Definition: RigDef_Validator.cpp:92
RigDef::Validator::Message::TYPE_INFO
@ TYPE_INFO
Definition: RigDef_Validator.h:55
RigDef::Validator::CheckAnimator
bool CheckAnimator(RigDef::Animator &def)
Definition: RigDef_Validator.cpp:323
RigDef
Definition: RigDef_File.cpp:32
RigDef::Validator::Message::TYPE_INVALID
@ TYPE_INVALID
Definition: RigDef_Validator.h:60
RigDef::Validator::SetCheckBeams
void SetCheckBeams(bool check_beams)
Definition: RigDef_Validator.h:77
RigDef::Animator
Definition: RigDef_File.h:550
RigDef::VideoCamera
Definition: RigDef_File.h:1411
RigDef::Validator::m_file
RigDef::DocumentPtr m_file
The parsed input file.
Definition: RigDef_Validator.h:121
RigDef::Shock3
Definition: RigDef_File.h:1218
RigDef::DocumentPtr
std::shared_ptr< Document > DocumentPtr
Definition: RigDef_Prerequisites.h:38
RigDef::Validator::Validate
bool Validate()
Definition: RigDef_Validator.cpp:56
RigDef::Validator::AddModule
bool AddModule(Ogre::String const &module_name)
Adds a vehicle module to the validated configuration.
Definition: RigDef_Validator.cpp:141
RigDef::Validator::CheckGearbox
bool CheckGearbox()
Checks there's at least 1 forward gear.
Definition: RigDef_Validator.cpp:154
RigDef::Validator::Message::TYPE_FATAL_ERROR
@ TYPE_FATAL_ERROR
Definition: RigDef_Validator.h:58
RigDef_File.h
Data structures representing 'truck' file format, see https://docs.rigsofrods.org/vehicle-creation/fi...