├── .gitattributes
├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── SourceMonitorOS.smproj
├── documentation
├── architecture
│ ├── architecture.drawio
│ ├── architecture.svg
│ └── readme.md
├── history.md
├── readme.md
└── smcore
│ ├── About SourceMonitor.png
│ ├── about.md
│ ├── license.md
│ ├── options.md
│ ├── project.md
│ ├── readme.md
│ ├── smstring.md
│ └── version.md
├── playground
├── logging
│ ├── CMakeLists.txt
│ ├── Logging_en_150.ts
│ ├── logging.cpp
│ ├── logging.h
│ └── main.cpp
├── readme.md
└── resource
│ ├── CMakeLists.txt
│ ├── SourceMonitorOS.ico
│ ├── main.cpp
│ ├── mainwindow.cpp
│ ├── mainwindow.h
│ ├── mainwindow.ui
│ └── smcore.qrc
├── readme.md
├── smcli
├── CMakeLists.txt
├── main.cpp
├── readme.md
└── smcli_en_150.ts
├── smcore
├── CMakeLists.txt
├── about.cpp
├── about.h
├── archivereader.cpp
├── archivereader.h
├── checkpoint.cpp
├── checkpoint.h
├── classinfo.h
├── error.cpp
├── error.h
├── factory.cpp
├── factory.h
├── language.cpp
├── language.h
├── languagebase.cpp
├── languagebase.h
├── languages.cpp
├── languages.h
├── license.cpp
├── license.h
├── optionflags.h
├── options.cpp
├── options.h
├── printvector.h
├── project.cpp
├── project.h
├── readme.md
├── smcheckpointsreader.cpp
├── smcheckpointsreader.h
├── smlanguagereader.cpp
├── smlanguagereader.h
├── smpreader.cpp
├── smpreader.h
├── smstring.cpp
├── smstring.h
├── subdirectorymode.h
├── version.cpp
└── version.h
├── smgui
├── CMakeLists.txt
├── main.cpp
├── readme.md
├── sggui.cpp
├── sggui.h
├── sggui.ui
├── sggui_en_150.ts
├── sgoptions.cpp
├── sgoptions.h
└── sgoptions.ui
└── smtest
├── CMakeLists.txt
├── main.cpp
├── readme.md
├── test_about.cpp
├── test_about.h
├── test_checkpoint.cpp
├── test_checkpoint.h
├── test_license.cpp
├── test_license.h
├── test_options.cpp
├── test_options.h
├── test_project.cpp
├── test_project.h
├── test_smpreader.cpp
├── test_smpreader.h
├── test_version.cpp
├── test_version.h
├── testfiles
└── osm.smp
└── testrunner.h
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # This file is used to ignore files which are generated
2 | # ----------------------------------------------------------------------------
3 |
4 | *~
5 | *.autosave
6 | *.a
7 | *.core
8 | *.moc
9 | *.o
10 | *.obj
11 | *.orig
12 | *.rej
13 | *.so
14 | *.so.*
15 | *_pch.h.cpp
16 | *_resource.rc
17 | *.qm
18 | .#*
19 | *.*#
20 | core
21 | !core/
22 | tags
23 | .DS_Store
24 | .directory
25 | *.debug
26 | Makefile*
27 | *.prl
28 | *.app
29 | moc_*.cpp
30 | ui_*.h
31 | qrc_*.cpp
32 | Thumbs.db
33 | *.res
34 | *.rc
35 | /.qmake.cache
36 | /.qmake.stash
37 |
38 | # qtcreator generated files
39 | *.pro.user*
40 |
41 | # xemacs temporary files
42 | *.flc
43 |
44 | # Vim temporary files
45 | .*.swp
46 |
47 | # Visual Studio generated files
48 | *.ib_pdb_index
49 | *.idb
50 | *.ilk
51 | *.pdb
52 | *.sln
53 | *.suo
54 | *.vcproj
55 | *vcproj.*.*.user
56 | *.ncb
57 | *.sdf
58 | *.opensdf
59 | *.vcxproj
60 | *vcxproj.*
61 |
62 | # MinGW generated files
63 | *.Debug
64 | *.Release
65 |
66 | # Python byte code
67 | *.pyc
68 |
69 | # Binaries
70 | # --------
71 | *.dll
72 | *.exe
73 |
74 | ### Added by ThirtySomething
75 | CMakeLists.txt.user
76 | build*
77 | .vscode
78 | /.vscode
79 | *.bak
80 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # *******************************************************************************
2 | # Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a
5 | # copy of this software and associated documentation files (the "Software"),
6 | # to deal in the Software without restriction, including without limitation
7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | # and/or sell copies of the Software, and to permit persons to whom the
9 | # Software is furnished to do so, subject to the following conditions:
10 | #
11 | # The above copyright notice and this permission notice shall be included
12 | # in all copies or substantial portions of the Software.
13 | #
14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | # DEALINGS IN THE SOFTWARE.
21 | # *******************************************************************************
22 |
23 | cmake_minimum_required(VERSION 3.5)
24 |
25 | project(SourceMonitorOS LANGUAGES CXX VERSION 0.0.1 DESCRIPTION "SourceMonitor OpenSource")
26 |
27 | # *******************************************************************************
28 | # Settings for smcore
29 | # *******************************************************************************
30 | add_subdirectory(smcore)
31 |
32 | # *******************************************************************************
33 | # Settings for smcli
34 | # *******************************************************************************
35 | add_subdirectory(smcli)
36 | target_include_directories(smcli PRIVATE smcore)
37 |
38 | # *******************************************************************************
39 | # Settings for smgui
40 | # *******************************************************************************
41 | add_subdirectory(smgui)
42 | target_include_directories(smgui PRIVATE smcore)
43 |
44 | # *******************************************************************************
45 | # Settings for smtest
46 | # *******************************************************************************
47 | add_subdirectory(smtest)
48 | target_include_directories(smtest PRIVATE smcore)
49 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (C) 1999 by Jim Wanner and the SourceMonitor team
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a
6 | copy of this software and associated documentation files (the "Software"),
7 | to deal in the Software without restriction, including without limitation
8 | the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | and/or sell copies of the Software, and to permit persons to whom the
10 | Software is furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included
13 | in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
16 | KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
17 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
18 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
22 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 | DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/SourceMonitorOS.smproj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SourceMonitor/SourceMonitorOS/1586c61f730459ab47d7f08f2c29e90ed415ca04/SourceMonitorOS.smproj
--------------------------------------------------------------------------------
/documentation/architecture/architecture.drawio:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/documentation/architecture/readme.md:
--------------------------------------------------------------------------------
1 | # Architecture
2 |
3 | This is the technical documentation about the systems architecture.
4 |
5 | ## Graphical overview
6 |
7 | ![Graphical overview][img_architecture]
8 |
9 | [img_architecture]: ./architecture.svg
10 |
--------------------------------------------------------------------------------
/documentation/history.md:
--------------------------------------------------------------------------------
1 | # History of SourceMonitorOS
2 |
3 | ## 2022-12-12
4 |
5 | - Fixed naming issues
6 | - Settigs are named options in the original
7 | - Because of redundancies
8 | - Core classes named as usual
9 | - CLI classes are prefixed with `sc`
10 | - UI classes are prefixed with `sm`
11 | - SMMainWindow is named SMGUI
12 | - Introduced factory class
13 | - Draft options dialog
14 | - Options perform a load on object creation to initialize the member variables
15 |
16 | ## 2022-12-04
17 |
18 | - Extended the readme with a hint about compilation
19 | - Updated the readme with informations about the used technologies
20 |
21 | ## 2022-12-02
22 |
23 | - Updated readme files
24 | - Added SourceMonitor project file
25 |
26 | ## 2022-11-29
27 |
28 | - Added dialog box for "View License
29 | - Added "About" class
30 | - Added dialog box for "About SourceMonitorOS"
31 | - Added documentation for "About"
32 | - Removed ".vscode" folder
33 |
34 | ## 2022-11-27
35 |
36 | - Added/reworked tests for license and settings.
37 | - Updated documentation.
38 |
39 | ## 2022-11-23
40 |
41 | - Added documentation for settings.
42 | - Added missing translation feature to smcore.
43 | - Added subproject for tests, smtest.
44 | - Improved CMakeLists.txt with details for translation.
45 | - Enable all compile warnings in CMakeLists.txt files.
46 | - Uniform header for CMakeLists.txt and source files.
47 |
48 | ## 2022-11-20
49 |
50 | - Added basic settings object.
51 |
52 | ## 2022-11-12
53 |
54 | - Start SourceMonitorOS from scratch, initial setup with smgui, smcore and smcli.
55 |
--------------------------------------------------------------------------------
/documentation/readme.md:
--------------------------------------------------------------------------------
1 | # Documentation
2 |
3 | In this directory the documentation of SourceMonitorOS is located. At the moment this is a loose collection of [markdown][markdown_github] files. For later there is a need to use [QT help system][qt_help].
4 |
5 | ## History
6 |
7 | To get an information about the history of SourceMonitorOS, please see [here][file_history].
8 |
9 | ## Available descriptions
10 |
11 | - [Architecture][doc_architecture] - The systems architecture
12 | - [SMCORE][doc_smcore] - The core functionality
13 |
14 | [doc_architecture]: ./architecture/readme.md
15 | [doc_smcore]: ./smcore/readme.md
16 | [file_history]: ./history.md
17 | [markdown_github]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
18 | [qt_help]: https://doc.qt.io/qt-6.2/qthelp-framework.html
19 |
--------------------------------------------------------------------------------
/documentation/smcore/About SourceMonitor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SourceMonitor/SourceMonitorOS/1586c61f730459ab47d7f08f2c29e90ed415ca04/documentation/smcore/About SourceMonitor.png
--------------------------------------------------------------------------------
/documentation/smcore/about.md:
--------------------------------------------------------------------------------
1 | # The about dialog
2 |
3 | The help menu offers an entry named "About SourceMonitorOS". This will fire up a dialog with rough information about the Software. In the original software the dialog looks like this:
4 |
5 | ![SourceMonitor About Dialog][smabout]
6 |
7 | ## Implementation
8 |
9 | This is a functionality of `smcore` and located in `smcore/about.*`.
10 |
11 | ### Public API
12 |
13 | ```c++
14 | namespace smos
15 | {
16 | namespace smcore
17 | {
18 | class About
19 | {
20 | public:
21 | /**
22 | * @brief Get the about text
23 | *
24 | * @return QString
25 | */
26 | static smos::smcore::SMSring getAbout(void);
27 | };
28 | }
29 | }
30 | ```
31 |
32 | ### Usage
33 |
34 | ```c++
35 | #include "about.h"
36 |
37 | smos::smcore::SMSring about = smos::smcore::About::getAbout();
38 | ```
39 |
40 | [smabout]: ./About%20SourceMonitor.png
41 |
--------------------------------------------------------------------------------
/documentation/smcore/license.md:
--------------------------------------------------------------------------------
1 | # The used license
2 |
3 | This is a static function to get the license text to display. Actually this is a hardcoded MIT license. There was the idea about reading the text from a file. But what to display in case the file does not exist?
4 |
5 | ## Implementation
6 |
7 | This is a functionality of `smcore` and located in `smcore/license.*`.
8 |
9 | ### Public API
10 |
11 | ```c++
12 | namespace smos
13 | {
14 | namespace smcore
15 | {
16 | class License
17 | {
18 | public:
19 | /**
20 | * @brief Get the license text
21 | *
22 | * @return smos::smcore::SMSring
23 | */
24 | static smos::smcore::SMSring getLicense(void);
25 | };
26 | }
27 | }
28 |
29 | ```
30 |
31 | ### Usage
32 |
33 | ```c++
34 | #include "license.h"
35 |
36 | smos::smcore::SMSring license = smos::smcore::License::getLicense();
37 | ```
38 |
39 | ## Possible issues
40 |
41 | At the moment the project uses the [MIT][license_mit]. Unfortunately QT proposes other [licenses][license_qt], e. g. the [LGPL][license_lgpl]. This needs further investigation.
42 |
43 | => According to [this][license_ok] article there is no problem with this combination.
44 |
45 | [license_lgpl]: https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License
46 | [license_mit]: https://en.wikipedia.org/wiki/MIT_License
47 | [license_ok]: https://softwareengineering.stackexchange.com/questions/267582/is-it-ok-to-use-the-mit-license-for-a-project-that-uses-qt
48 | [license_qt]: https://www.qt.io/download-open-source#consider
49 |
--------------------------------------------------------------------------------
/documentation/smcore/options.md:
--------------------------------------------------------------------------------
1 | # The options object
2 |
3 | There is a need to have persistent options somewhere. For this is this object. Because of the plattform independency the options are stored in an [INI file][wiki_ini_file]. This kind of format is supported by [Qts settings object][qt_qsettings].
4 |
5 | ## Implementation
6 |
7 | This is a functionality of `smcore` and located in `smcore/options.*`.
8 |
9 | ## Internals
10 |
11 | - Section names will be always in uppercase letters.
12 | - Key names will be always in lowercase letters.
13 | - For both the class will take care about.
14 | - On creation of the object a load is performed to initialize the member variables.
15 |
16 | ### Public API
17 |
18 | ```c++
19 | namespace smos
20 | {
21 | namespace smcore
22 | {
23 | class Options
24 | {
25 | public:
26 | /**
27 | * @brief Default constructor
28 | *
29 | * @param optionsfile Name of options file
30 | */
31 | Options(smos::smcore::SMSring optionsfile);
32 |
33 | /**
34 | * @brief Default destructor
35 | *
36 | */
37 | ~Options(void);
38 |
39 | /**
40 | * @brief Get the editor call with filename templated
41 | *
42 | * @return smos::smcore::SMSring
43 | */
44 | smos::smcore::SMSring codeEditorGet(void);
45 |
46 | /**
47 | * @brief Get the editor call with filename templated
48 | *
49 | * @param codeeditor smos::smcore::SMSring
50 | */
51 | void codeEditorSet(smos::smcore::SMSring codeeditor);
52 |
53 | /**
54 | * @brief Get the absolute path to the logfile
55 | *
56 | * @return smos::smcore::SMSring The absolute path to the logfile
57 | */
58 | smos::smcore::SMSring logfileNameGet(void);
59 |
60 | /**
61 | * @brief Set the name (and path) of the logfile
62 | *
63 | * @param logfileName Name (and path) of the logfile to use
64 | */
65 | void logfileNameSet(smos::smcore::SMSring logfileName);
66 | };
67 | }
68 | }
69 | ```
70 |
71 | ### Usage
72 |
73 | ```c++
74 | #include "settings.h"
75 |
76 | smos::smcore::SMSettings settings = smos::smcore::SMSettings("smos_core.ini");
77 |
78 | smos::smcore::SMSring logfileOld = settings.logfileNameGet();
79 | settings.logfileNameSet("logfilenew.log");
80 | ```
81 |
82 | ## Possible issues
83 |
84 | This object could be a [singleton][wiki_singleton]. But the intention is to create an instance at the top most level and then [inject][wiki_dependency_injection] it into the core.
85 |
86 | [qt_qsettings]: https://doc.qt.io/qt-6.2/qsettings.html
87 | [wiki_dependency_injection]: https://en.wikipedia.org/wiki/Dependency_injection
88 | [wiki_ini_file]: https://en.wikipedia.org/wiki/INI_file
89 | [wiki_singleton]: https://en.wikipedia.org/wiki/Singleton_pattern
90 |
--------------------------------------------------------------------------------
/documentation/smcore/project.md:
--------------------------------------------------------------------------------
1 | # The project object
2 |
3 | This object contains the project data. This means the project name, the checkpoints, the metrics and much more.
4 |
5 | ## Implementation
6 |
7 | This is a functionality of `smcore` and located in `smcore/project.*`.
8 |
9 | ## Internals
10 |
11 | - The `loadProject` and `saveProject` methods are static.
12 |
13 | ### Public API
14 |
15 | ```c++
16 | namespace smos
17 | {
18 | namespace smcore
19 | {
20 | class Project
21 | {
22 | public:
23 | /**
24 | * @brief Construct a new Project object
25 | */
26 | Project(void);
27 |
28 | /**
29 | * @brief Destroy the Project object
30 | */
31 | ~Project(void);
32 |
33 | /**
34 | * @brief Load project data
35 | *
36 | * @param filename Name of project file
37 | * @param project Pointer to project object
38 | *
39 | * @return smos::smcore::Error::ErrorCode
40 | */
41 | static smos::smcore::Error::ErrorCode loadProject(const smos::smcore::SMString &filename, Project &project);
42 |
43 | /**
44 | * @brief Save project data
45 | *
46 | * @param filename Name of project file
47 | * @param project Pointer to project object
48 | * @param force Force saving in case project file already exist
49 | *
50 | * @return smos::smcore::Error::ErrorCode
51 | */
52 | static smos::smcore::Error::ErrorCode saveProject(const smos::smcore::SMString &filename, Project &project, bool force = false);
53 |
54 | /**
55 | * @brief Get the Project Name
56 | *
57 | * @return smos::smcore::SMString
58 | */
59 | smos::smcore::SMString getProjectName(void) const;
60 |
61 | /**
62 | * @brief Set the Project Name
63 | *
64 | * @param projectName
65 | */
66 | void setProjectName(smos::smcore::SMString projectName);
67 |
68 | /**
69 | * @brief Enable writing to stream
70 | *
71 | * @param os Outputstream to write to
72 | * @param obj Project object to write to stream
73 | *
74 | * @return std::ostream&
75 | */
76 | friend std::ostream &operator<<(std::ostream &os, const Project &obj);
77 |
78 | /**
79 | * @brief Enable reading from stream
80 | *
81 | * @param is Inputstream to read from
82 | * @param obj Project object to read from stream
83 | *
84 | * @return std::istream&
85 | */
86 | friend std::istream &operator>>(std::istream &is, Project &obj);
87 | };
88 | }
89 | }
90 | ```
91 |
92 | ### Usage
93 |
94 | ```c++
95 | #include "project.h"
96 |
97 | // Creation of project
98 | smos::smcore::SMString projectNameSet = smos::smcore::SMString("ProjectName");
99 | smos::smcore::Project objProject;
100 |
101 | // Change project name
102 | objProject.setProjectName(projectNameSet);
103 | smos::smcore::SMString projectNameGet = objProject.getProjectName();
104 |
105 | // Save and load project
106 | smos::smcore::SMString filename = smos::smcore::SMString("project.dat");
107 | smos::smcore::Error::ErrorCode result = smos::smcore::Project::saveProject(filename, objProject);
108 | result = smos::smcore::Project::loadProject(filename, objProject);
109 | ```
110 |
111 | ## Possible issues
112 |
--------------------------------------------------------------------------------
/documentation/smcore/readme.md:
--------------------------------------------------------------------------------
1 | # Documentation of SMCORE
2 |
3 | - [About][doc_about]
4 | - [License][doc_license]
5 | - [Options][doc_options]
6 | - [Project][doc_project]
7 | - [SMString][doc_smstring]
8 | - [Version][doc_version]
9 |
10 | [doc_about]: ./about.md
11 | [doc_license]: ./license.md
12 | [doc_options]: ./options.md
13 | [doc_project]: ./project.md
14 | [doc_smstring]: ./smstring.md
15 | [doc_version]: ./version.md
16 |
--------------------------------------------------------------------------------
/documentation/smcore/smstring.md:
--------------------------------------------------------------------------------
1 | # The smstring object
2 |
3 | WTF?! There are so much possibilities for using strings in C++ - don't know how to do a wise decision for stalbe use. There are a few possibilities
4 |
5 | - std::string
6 | - std::wstring
7 | - [ICU][lib_icu]
8 |
9 | We have to keep always in mind that the source code could contain comments or variables in local languages. Imagine source code in Arabic (from right to left, from top to bottom), Chinese (from left to right, from top to bottom), Hebrew (from right to left, from top to bottom), Japanese (from right to left, from top to bottom) or Thai (from left to right, from top to bottom) - it will not be easy to deal with such source code.
10 |
11 | ## Implementation
12 |
13 | This is a functionality of `smcore` and located in `smcore/smstring.*`.
14 |
15 | The decision of which kind of string handling is moved to the future. To enable the project for working a simple `typedef` on `std::string` is used as placeholder for the future implementation. Of course this is not safe for the future but better than nothing.
16 |
17 | ### Public API
18 |
19 | ```c++
20 | namespace smos
21 | {
22 | namespace smcore
23 | {
24 | typedef std::string SMSring;
25 | }
26 | }
27 | ```
28 |
29 | ### Usage
30 |
31 | ```c++
32 | #include "smstring.h"
33 |
34 | smos::smcore::SMString message = "Hello world";
35 | ```
36 |
37 | [lib_icu]: https://icu.unicode.org/design/cpp
38 |
--------------------------------------------------------------------------------
/documentation/smcore/version.md:
--------------------------------------------------------------------------------
1 | # The project object
2 |
3 | This object contains the program version information.
4 |
5 | ## Implementation
6 |
7 | This is a functionality of `smcore` and located in `smcore/version.*`.
8 |
9 | ## Internals
10 |
11 | ### Public API
12 |
13 | ```c++
14 | namespace smos
15 | {
16 | namespace smcore
17 | {
18 | class Version
19 | {
20 | public:
21 | /**
22 | * @brief Default constructor
23 | */
24 | Version(void);
25 |
26 | /**
27 | * @brief Default destructor
28 | */
29 | ~Version(void);
30 |
31 | /**
32 | * @brief Copy constructor
33 | *
34 | * @param versionObject Version to copy data from
35 | */
36 | Version(const Version &versionObject);
37 |
38 | /**
39 | * @brief Assignment operator
40 | *
41 | * @param versionObject
42 | * @return Version& reference to current object
43 | */
44 | Version &operator=(const Version &versionObject);
45 |
46 | /**
47 | * @brief Equal operator
48 | *
49 | * @param versionObject Version to compare with
50 | * @return bool True on equal, otherwise false
51 | */
52 | bool operator==(const Version &versionObject) const;
53 |
54 | /**
55 | * @brief Non equal operator
56 | *
57 | * @param versionObject Version to compare with
58 | * @return bool True on non equal, otherwise false
59 | */
60 | bool operator!=(const Version &versionObject) const;
61 |
62 | /**
63 | * @brief Get version information as string
64 | *
65 | * @return smos::smcore::SMString
66 | */
67 | smos::smcore::SMString AsString(void) const;
68 |
69 | /**
70 | * @brief Set the Version object
71 | *
72 | * @param major Major version information
73 | * @param minor Minor version information
74 | * @param revision Revision version informationi
75 | */
76 | void SetVersion(const short &major, const short &minor, const short &revision);
77 | };
78 | }
79 | }
80 |
81 | ```
82 |
83 | ### Usage
84 |
85 | ```c++
86 | smos::smcore::Version verObjectSrc;
87 | smos::smcore::Version verObjectDst(verObjectSrc);
88 | smos::smcore::SMString versionSrc = verObjectSrc.AsString();
89 |
90 | verObjectSrc.SetVersion(1, 2, 3);
91 | verObjectDst = verObjectSrc;
92 | ```
93 |
94 | ## Possible issues
95 |
--------------------------------------------------------------------------------
/playground/logging/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 |
3 | project(logging LANGUAGES CXX)
4 |
5 | set(CMAKE_AUTOUIC ON)
6 | set(CMAKE_AUTOMOC ON)
7 | set(CMAKE_AUTORCC ON)
8 |
9 | set(CMAKE_CXX_STANDARD 17)
10 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
11 |
12 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core LinguistTools)
13 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core LinguistTools)
14 |
15 | set(TS_FILES logging_en_150.ts)
16 |
17 | add_executable(logging
18 | main.cpp
19 | logging.h
20 | logging.cpp
21 | ${TS_FILES}
22 | )
23 | target_link_libraries(logging Qt${QT_VERSION_MAJOR}::Core)
24 |
25 | if(COMMAND qt_create_translation)
26 | qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
27 | else()
28 | qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
29 | endif()
30 |
31 | install(TARGETS logging
32 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
33 |
--------------------------------------------------------------------------------
/playground/logging/Logging_en_150.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/playground/logging/logging.cpp:
--------------------------------------------------------------------------------
1 | #include "logging.h"
2 |
--------------------------------------------------------------------------------
/playground/logging/logging.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
--------------------------------------------------------------------------------
/playground/logging/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | // #include "logging.h"
6 |
7 | int main(int argc, char *argv[])
8 | {
9 | QCoreApplication a(argc, argv);
10 |
11 | QTranslator translator;
12 | const QStringList uiLanguages = QLocale::system().uiLanguages();
13 | for (const QString &locale : uiLanguages)
14 | {
15 | const QString baseName = "logging_" + QLocale(locale).name();
16 | if (translator.load(":/i18n/" + baseName))
17 | {
18 | a.installTranslator(&translator);
19 | break;
20 | }
21 | }
22 |
23 | qDebug("Test!");
24 |
25 | return a.exec();
26 | }
27 |
--------------------------------------------------------------------------------
/playground/readme.md:
--------------------------------------------------------------------------------
1 | # Playground
2 |
3 | In this directory you can find some simple projects (also to be opened in QT creator) for testing some features of QT.
4 |
5 | - To test/setup logging (logging)
6 | - To test/setup usage of resources (resource)
7 |
--------------------------------------------------------------------------------
/playground/resource/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5)
2 |
3 | project(resource VERSION 0.1 LANGUAGES CXX)
4 |
5 | set(CMAKE_AUTOUIC ON)
6 | set(CMAKE_AUTOMOC ON)
7 | set(CMAKE_AUTORCC ON)
8 |
9 | set(CMAKE_CXX_STANDARD 17)
10 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
11 |
12 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
13 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
14 |
15 | set(PROJECT_SOURCES
16 | main.cpp
17 | mainwindow.cpp
18 | mainwindow.h
19 | mainwindow.ui
20 | smcore.qrc
21 | )
22 |
23 | qt_add_resources(${PROJECT_NAME}
24 | smcore.qrc
25 | )
26 |
27 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
28 | qt_add_executable(resource
29 | MANUAL_FINALIZATION
30 | ${PROJECT_SOURCES}
31 | )
32 |
33 | # Define target properties for Android with Qt 6 as:
34 | # set_property(TARGET resource APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
35 | # ${CMAKE_CURRENT_SOURCE_DIR}/android)
36 | # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
37 | else()
38 | if(ANDROID)
39 | add_library(resource SHARED
40 | ${PROJECT_SOURCES}
41 | )
42 |
43 | # Define properties for Android with Qt 5 after find_package() calls as:
44 | # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
45 | else()
46 | add_executable(resource
47 | ${PROJECT_SOURCES}
48 | )
49 | endif()
50 | endif()
51 |
52 | target_link_libraries(resource PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
53 |
54 | set_target_properties(resource PROPERTIES
55 | MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
56 | MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
57 | MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
58 | MACOSX_BUNDLE TRUE
59 | WIN32_EXECUTABLE TRUE
60 | )
61 |
62 | install(TARGETS resource
63 | BUNDLE DESTINATION .
64 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
65 |
66 | if(QT_VERSION_MAJOR EQUAL 6)
67 | qt_finalize_executable(resource)
68 | endif()
69 |
--------------------------------------------------------------------------------
/playground/resource/SourceMonitorOS.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SourceMonitor/SourceMonitorOS/1586c61f730459ab47d7f08f2c29e90ed415ca04/playground/resource/SourceMonitorOS.ico
--------------------------------------------------------------------------------
/playground/resource/main.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 |
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | MainWindow w;
9 | w.show();
10 | w.setWindowIcon(QIcon(":/SourceMonitorOS.ico"));
11 | return a.exec();
12 | }
13 |
--------------------------------------------------------------------------------
/playground/resource/mainwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include "./ui_mainwindow.h"
3 |
4 | MainWindow::MainWindow(QWidget *parent)
5 | : QMainWindow(parent)
6 | , ui(new Ui::MainWindow)
7 | {
8 | ui->setupUi(this);
9 | }
10 |
11 | MainWindow::~MainWindow()
12 | {
13 | delete ui;
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/playground/resource/mainwindow.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | QT_BEGIN_NAMESPACE
6 | namespace Ui { class MainWindow; }
7 | QT_END_NAMESPACE
8 |
9 | class MainWindow : public QMainWindow
10 | {
11 | Q_OBJECT
12 |
13 | public:
14 | MainWindow(QWidget *parent = nullptr);
15 | ~MainWindow();
16 |
17 | private:
18 | Ui::MainWindow *ui;
19 | };
20 |
--------------------------------------------------------------------------------
/playground/resource/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 600
11 |
12 |
13 |
14 | MainWindow
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/playground/resource/smcore.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | ./SourceMonitorOS.ico
4 |
5 |
6 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # SourceMonitorOS
2 |
3 | [Jim Wanner][wannerjim] retired from software development. This project aims to get the original SourceMonitor code of [Campwood Software LTD][campwoodsw] to become open source.
4 |
5 | ## Motivation
6 |
7 | Because of some licensed code and other issues a refactoring of the existing code base will be not done. Instead of this a re-write from scratch is aimed according to the functionality known from the original.
8 |
9 | _Getting there is half the fun. - Konfuzius_
10 |
11 | _A journey of a thousand miles begins with a single step. - Laotse_
12 |
13 | ## Definitions for environment
14 |
15 | - Programming language: [C++17][cpp17]
16 | - Build system: [CMake][cmake], minimum version 3.5
17 | - License: [MIT][licensemit]
18 | - Framework: [QT][qt] in version 6.2 LTS
19 |
20 | ### Compiling
21 |
22 | To compile the project the following prerequisites must be installed:
23 |
24 | - [CMake][cmake], minimum version 3.5
25 | - [QT][qt] in version 6.2 LTS
26 |
27 | A compiler should be installed during the installation of [QT][qt]. If you wish to use another compiler, you have to take care about this by yourself.
28 |
29 | Once the prerequisites are installed, you have to open the [CMakeLists.txt project][project_file] file of the root folder in [QT Creator][tool_qt_creator], select the kit of your choice and then press `Configure Project`. Then you can compile the code.
30 |
31 | ## Contribution
32 |
33 | This project is open source. Every kind of contribution is welcome. Usually by a fork and a pull request. The team will be happy about any kind of support. See here an incomplete list of possible areas you're able to support:
34 |
35 | - [](https://skillicons.dev) - [C++][cpp17], the basic programming language
36 | - [](https://skillicons.dev) - [CMake][cmake], the build system used
37 | - [](https://skillicons.dev) - [git][gitscm], the used code versioning system
38 | - [](https://skillicons.dev) - [GitHub][github], the hoster of the project code
39 | - [](https://skillicons.dev) - [GitHubActions][githubactions], used for CI/CD processes and other automations
40 | - [](https://skillicons.dev) - [Markdown][markdown], used for documentation, in [GitHub flavor][githubmarkdown]
41 | - [](https://skillicons.dev) - [QT][qt], the used framework
42 |
43 | ## Project folder organization
44 |
45 | Allthough there are CMake files existing up to know you need to run them using QT Creator.
46 |
47 | - In the folder [documentation][folder_documentation] you can find the documentation of SourceMonitorOS
48 | - In the folder [playground][folder_playground] you can find small programs for several tests
49 | - In the folder [smcli][folder_smcli] you can find the command line client of SourceMonitorOS
50 | - In the folder [smcore][folder_smcore] you can find the core functionality of SourceMonitorOS
51 | - In the folder [smgui][folder_smgui] you can find the UI of SourceMonitorOS
52 | - In the folder [smtest][folder_smtest] you can find the tests of at least the [smcore][folder_smcore].
53 |
54 | [campwoodsw]: https://www.campwoodsw.com/sourcemonitor.html
55 | [cmake]: https://www.cmake.org
56 | [cpp17]: https://en.wikipedia.org/wiki/C%2B%2B17
57 | [folder_documentation]: ./documentation/readme.md
58 | [folder_playground]: ./playground/readme.md
59 | [folder_smcli]: ./smcli/readme.md
60 | [folder_smcore]: ./smcore/readme.md
61 | [folder_smgui]: ./smgui/readme.md
62 | [folder_smtest]: ./smtest/readme.md
63 | [github]: https://www.github.com
64 | [githubactions]: https://github.com/features/actions
65 | [githubmarkdown]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
66 | [gitscm]: https://git-scm.com/
67 | [licensemit]: https://opensource.org/licenses/MIT
68 | [markdown]: https://daringfireball.net/projects/markdown/
69 | [project_file]: ./CMakeLists.txt
70 | [qt]: https://www.qt.io/
71 | [tool_qt_creator]: https://www.qt.io/product/development-tools
72 | [wannerjim]: https://campwoodsw.com/emcomp/about-us/
73 |
--------------------------------------------------------------------------------
/smcli/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # *******************************************************************************
2 | # Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a
5 | # copy of this software and associated documentation files (the "Software"),
6 | # to deal in the Software without restriction, including without limitation
7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | # and/or sell copies of the Software, and to permit persons to whom the
9 | # Software is furnished to do so, subject to the following conditions:
10 | #
11 | # The above copyright notice and this permission notice shall be included
12 | # in all copies or substantial portions of the Software.
13 | #
14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | # DEALINGS IN THE SOFTWARE.
21 | # *******************************************************************************
22 |
23 | cmake_minimum_required(VERSION 3.5)
24 |
25 | project(smcli LANGUAGES CXX VERSION 0.0.1 DESCRIPTION "SourceMonitor CLI")
26 |
27 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
28 |
29 | set(CMAKE_AUTOUIC ON)
30 | set(CMAKE_AUTOMOC ON)
31 | set(CMAKE_AUTORCC ON)
32 |
33 | set(CMAKE_CXX_STANDARD 17)
34 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
35 |
36 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core LinguistTools)
37 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core LinguistTools)
38 |
39 | set(SMCLI_TS_FILES
40 | smcli_en_150.ts
41 | )
42 |
43 | add_executable(smcli
44 | main.cpp
45 | ${SMCLI_TS_FILES}
46 | ${SMCORE_INCLUDE}
47 | )
48 |
49 | # Copy required files
50 | configure_file(./../LICENSE LICENSE COPYONLY)
51 | configure_file(./../smtest/testfiles/osm.smp osm.smp COPYONLY)
52 |
53 | target_compile_options(smcli PRIVATE
54 | $<$:/W4 /WX>
55 | $<$>:-Wall -Wextra -Wpedantic -Werror>
56 | )
57 |
58 | target_link_libraries(smcli Qt${QT_VERSION_MAJOR}::Core smcore)
59 |
60 | if(COMMAND qt_create_translation)
61 | qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${SMCLI_TS_FILES})
62 | endif()
63 |
64 | install(TARGETS smcli LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
65 |
66 | qt_finalize_executable(smcli)
67 |
--------------------------------------------------------------------------------
/smcli/main.cpp:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | // Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a
5 | // copy of this software and associated documentation files (the "Software"),
6 | // to deal in the Software without restriction, including without limitation
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | // and/or sell copies of the Software, and to permit persons to whom the
9 | // Software is furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 | //******************************************************************************
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include "smpreader.h"
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | int main(int argc, char *argv[])
35 | {
36 | QCoreApplication a(argc, argv);
37 |
38 | QTranslator translator;
39 | const QStringList uiLanguages = QLocale::system().uiLanguages();
40 | for (const QString &locale : uiLanguages)
41 | {
42 | const QString baseName = "smcli_" + QLocale(locale).name();
43 | if (translator.load(":/i18n/" + baseName))
44 | {
45 | a.installTranslator(&translator);
46 | break;
47 | }
48 | }
49 | // smos::smcore::SMPReader smpReader;
50 | // if (!smpReader.Open("d:\\SourceMonitor\\SourceMonitorOS\\test2.smp"))
51 | // return 1;
52 |
53 | std::string workingdir_raw = std::filesystem::u8path(argv[0]).remove_filename().string();
54 | QString workingdir = QString::fromStdString(workingdir_raw);
55 |
56 | // QStringList strList();
57 | QDirIterator it(workingdir, QStringList() << "*.smp", QDir::Files, QDirIterator::Subdirectories);
58 | while (it.hasNext())
59 | {
60 | QString filePath(it.next());
61 | qDebug() << filePath;
62 | smos::smcore::SMPReader smpReader;
63 | if (!smpReader.Open(filePath.toStdString()))
64 | return 1;
65 | smos::smcore::Project project;
66 | if (!smpReader.Read(project))
67 | return 1;
68 | }
69 |
70 | // smos::smcore::Project project;
71 | // if (!smpReader.Read(project))
72 | // return 1;
73 | return 0; // a.exec();
74 | }
75 |
--------------------------------------------------------------------------------
/smcli/readme.md:
--------------------------------------------------------------------------------
1 | # smcli
2 |
3 | In this directory the command line client of SourceMonitorOS is located.
4 |
5 | - Influence the software via XML files
6 | - Settings
7 | - Options
8 | - Language
9 | - Logging
10 | - Project handling
11 | - Read project file
12 | - Write project file
13 | - Create checkpoints
14 |
15 | The functionality called is located in [smcore][smcore].
16 |
17 | ## Technical information
18 |
19 | - The classes of `smcli` are prefixed with `sc` to avoid complications with the classes of `smcore`
20 |
21 | [smcore]: ./../smcore/readme.md
22 |
--------------------------------------------------------------------------------
/smcli/smcli_en_150.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/smcore/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # *******************************************************************************
2 | # Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | #
4 | # Permission is hereby granted, free of charge, to any person obtaining a
5 | # copy of this software and associated documentation files (the "Software"),
6 | # to deal in the Software without restriction, including without limitation
7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | # and/or sell copies of the Software, and to permit persons to whom the
9 | # Software is furnished to do so, subject to the following conditions:
10 | #
11 | # The above copyright notice and this permission notice shall be included
12 | # in all copies or substantial portions of the Software.
13 | #
14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | # DEALINGS IN THE SOFTWARE.
21 | # *******************************************************************************
22 |
23 | cmake_minimum_required(VERSION 3.5)
24 |
25 | project(smcore LANGUAGES CXX VERSION 0.0.1 DESCRIPTION "SourceMonitor Core Functionality")
26 |
27 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
28 | set(CMAKE_CXX_STANDARD 17)
29 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
30 |
31 | set(SMCORE_INCLUDE
32 | about.h
33 | archivereader.h
34 | checkpoint.h
35 | classinfo.h
36 | error.h
37 | factory.h
38 | language.h
39 | languages.h
40 | languagebase.h
41 | license.h
42 | optionflags.h
43 | options.h
44 | printvector.h
45 | project.h
46 | smcheckpointsreader.h
47 | smlanguagereader.h
48 | smpreader.h
49 | smstring.h
50 | subdirectorymode.h
51 | version.h
52 | )
53 |
54 | set(SMCORE_BODY
55 | about.cpp
56 | archivereader.cpp
57 | checkpoint.cpp
58 | error.cpp
59 | factory.cpp
60 | language.cpp
61 | languages.cpp
62 | languagebase.cpp
63 | license.cpp
64 | options.cpp
65 | project.cpp
66 | smcheckpointsreader.cpp
67 | smlanguagereader.cpp
68 | smpreader.cpp
69 | smstring.cpp
70 | version.cpp
71 | )
72 |
73 | add_library(smcore STATIC
74 | ${SMCORE_INCLUDE}
75 | ${SMCORE_BODY}
76 | )
77 |
78 | target_compile_options(smcore PRIVATE
79 | $<$:/W4 /WX>
80 | $<$>:-Wall -Wextra -Wpedantic -Werror>
81 | )
82 |
83 | target_link_libraries(smcore)
84 |
85 | target_compile_definitions(smcore PRIVATE SMCORE_LIBRARY)
86 |
87 | if(MSVC OR MINGW)
88 | target_compile_definitions(smcore PRIVATE _CRT_SECURE_NO_WARNINGS)
89 | endif()
90 |
--------------------------------------------------------------------------------
/smcore/about.cpp:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | // Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a
5 | // copy of this software and associated documentation files (the "Software"),
6 | // to deal in the Software without restriction, including without limitation
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | // and/or sell copies of the Software, and to permit persons to whom the
9 | // Software is furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 | //******************************************************************************
22 |
23 | #include "about.h"
24 |
25 | namespace smos
26 | {
27 | namespace smcore
28 | {
29 | //******************************************************************************
30 | smos::smcore::SMString About::getAbout(void)
31 | {
32 | smos::smcore::SMString aboutText = R"~~~~(SourceMonitor Tracks Source Code Quality and Quantity
33 | Version [InsertBuildInformationHere]
34 |
35 | SourceMonitor Team
36 | http://www.github.com/SourceMonitor
37 | © SourceMonitor Team)~~~~";
38 | return aboutText;
39 | }
40 | //******************************************************************************
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/smcore/about.h:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | // Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a
5 | // copy of this software and associated documentation files (the "Software"),
6 | // to deal in the Software without restriction, including without limitation
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | // and/or sell copies of the Software, and to permit persons to whom the
9 | // Software is furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 | //******************************************************************************
22 |
23 | #pragma once
24 |
25 | #include "smstring.h"
26 |
27 | namespace smos
28 | {
29 | namespace smcore
30 | {
31 | class About
32 | {
33 | public:
34 | /**
35 | * @brief Get the about text
36 | *
37 | * @return QString
38 | */
39 | static smos::smcore::SMString getAbout(void);
40 |
41 | private:
42 | /**
43 | * @brief Hide constructor to avoid instances
44 | *
45 | */
46 | About(void);
47 |
48 | /**
49 | * @brief Hide destructor to avoid instances
50 | *
51 | */
52 | ~About(void);
53 | };
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/smcore/archivereader.cpp:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | // Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a
5 | // copy of this software and associated documentation files (the "Software"),
6 | // to deal in the Software without restriction, including without limitation
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | // and/or sell copies of the Software, and to permit persons to whom the
9 | // Software is furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 | //******************************************************************************
22 |
23 | #include "archivereader.h"
24 |
25 | namespace smos
26 | {
27 | namespace smcore
28 | {
29 | //******************************************************************************
30 | unsigned int ArchiveReader::ReadCount()
31 | {
32 | // reads the size of the container stored in the file
33 | std::uint16_t nCount = Read();
34 | if (nCount != UINT16_MAX)
35 | return nCount;
36 |
37 | // stored size is 32 bits and we need to read it again
38 | std::uint32_t dwCount = Read();
39 | return dwCount;
40 | }
41 | //******************************************************************************
42 | unsigned int ArchiveReader::ReadStringLength()
43 | {
44 | // the logic of this function is copied from the CArchive class
45 | unsigned char byteLength = Read();
46 | if (byteLength < 0xff)
47 | return byteLength;
48 |
49 | unsigned short shortLength = Read();
50 | if (shortLength == 0xfffe)
51 | {
52 | // UNICODE string prefix (length will follow)
53 | return (unsigned int)-1;
54 | }
55 | else if (shortLength == UINT16_MAX)
56 | {
57 | // read DWORD of length
58 | unsigned long longLength = Read();
59 | return (unsigned int)longLength;
60 | }
61 | else
62 | return shortLength;
63 | }
64 | //******************************************************************************
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/smcore/checkpoint.cpp:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | // Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a
5 | // copy of this software and associated documentation files (the "Software"),
6 | // to deal in the Software without restriction, including without limitation
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | // and/or sell copies of the Software, and to permit persons to whom the
9 | // Software is furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 | //******************************************************************************
22 |
23 | #pragma once
24 |
25 | #include "checkpoint.h"
26 |
27 | namespace smos
28 | {
29 | namespace smcore
30 | {
31 | //******************************************************************************
32 | Checkpoint::Checkpoint(void) : m_version(), m_name("")
33 | {
34 | }
35 | //******************************************************************************
36 | Checkpoint::~Checkpoint(void)
37 | {
38 | }
39 | //******************************************************************************
40 | smos::smcore::Version Checkpoint::versionGet(void)
41 | {
42 | return this->m_version;
43 | }
44 | //******************************************************************************
45 | void Checkpoint::versionSet(const smos::smcore::Version &version)
46 | {
47 | this->m_version = version;
48 | }
49 | //******************************************************************************
50 | smos::smcore::SMString Checkpoint::checkpointNameGet(void)
51 | {
52 | return this->m_name;
53 | }
54 | //******************************************************************************
55 | void Checkpoint::checkpointNameSet(const smos::smcore::SMString &checkpointName)
56 | {
57 | this->m_name = checkpointName;
58 | }
59 | //******************************************************************************
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/smcore/checkpoint.h:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | // Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a
5 | // copy of this software and associated documentation files (the "Software"),
6 | // to deal in the Software without restriction, including without limitation
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | // and/or sell copies of the Software, and to permit persons to whom the
9 | // Software is furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 | //******************************************************************************
22 |
23 | #pragma once
24 |
25 | #include "archivereader.h"
26 | #include "smstring.h"
27 | #include "version.h"
28 |
29 | namespace smos
30 | {
31 | namespace smcore
32 | {
33 | class Checkpoint
34 | {
35 | public:
36 | /**
37 | * @brief Default constructor
38 | *
39 | */
40 | Checkpoint(void);
41 |
42 | /**
43 | * @brief Default destructor
44 | *
45 | */
46 | ~Checkpoint(void);
47 |
48 | /**
49 | * @brief Get version information object
50 | *
51 | * @return smos::smcore::Version
52 | */
53 | smos::smcore::Version versionGet(void);
54 |
55 | /**
56 | * @brief Set version information object
57 | *
58 | * @param version Version information object
59 | */
60 | void versionSet(const smos::smcore::Version &version);
61 |
62 | /**
63 | * @brief Get name of checkpoint
64 | *
65 | * @return smos::smcore::SMString
66 | */
67 | smos::smcore::SMString checkpointNameGet(void);
68 |
69 | /**
70 | * @brief Set name of checkpoint
71 | *
72 | * @param checkpointName
73 | */
74 | void checkpointNameSet(const smos::smcore::SMString &checkpointName);
75 |
76 | protected:
77 | /**
78 | * @brief Version information of checkpoint
79 | *
80 | */
81 | smos::smcore::Version m_version;
82 |
83 | /**
84 | * @brief Name of checkpoins
85 | */
86 | smos::smcore::SMString m_name;
87 | };
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/smcore/classinfo.h:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | // Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a
5 | // copy of this software and associated documentation files (the "Software"),
6 | // to deal in the Software without restriction, including without limitation
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | // and/or sell copies of the Software, and to permit persons to whom the
9 | // Software is furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 | //******************************************************************************
22 |
23 | #pragma once
24 |
25 | #include
26 |
27 | namespace smos
28 | {
29 | namespace smcore
30 | {
31 | struct ClassInfo
32 | {
33 | std::string m_name;
34 | };
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/smcore/error.cpp:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | // Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a
5 | // copy of this software and associated documentation files (the "Software"),
6 | // to deal in the Software without restriction, including without limitation
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | // and/or sell copies of the Software, and to permit persons to whom the
9 | // Software is furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 | //******************************************************************************
22 |
23 | #include "error.h"
24 |
25 | namespace smos
26 | {
27 | namespace smcore
28 | {
29 | //******************************************************************************
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/smcore/error.h:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | // Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a
5 | // copy of this software and associated documentation files (the "Software"),
6 | // to deal in the Software without restriction, including without limitation
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | // and/or sell copies of the Software, and to permit persons to whom the
9 | // Software is furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 | //******************************************************************************
22 |
23 | #pragma once
24 |
25 | #include "smstring.h"
26 |
27 | // See error class in C++ with enum
28 | // https://stackoverflow.com/questions/21295935/can-a-c-enum-class-have-methods
29 | // And how to convert enum to string
30 | // https://stackoverflow.com/questions/28828957/enum-to-string-in-modern-c11-c14-c17-and-future-c20
31 |
32 | namespace smos
33 | {
34 | namespace smcore
35 | {
36 | class Error
37 | {
38 | public:
39 | enum ErrorCode
40 | {
41 | ERR_NONE = 0,
42 | ERR_PROJECT_ALREADY_EXIST,
43 | ERR_PROJECT_DOES_NOT_EXIST,
44 | ERR_PROJECT_INVALID,
45 | };
46 | };
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/smcore/factory.cpp:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | // Copyright (C) 1999 Jim Wanner and the SourceMonitor team.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a
5 | // copy of this software and associated documentation files (the "Software"),
6 | // to deal in the Software without restriction, including without limitation
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | // and/or sell copies of the Software, and to permit persons to whom the
9 | // Software is furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | // DEALINGS IN THE SOFTWARE.
21 | //******************************************************************************
22 |
23 | #include "factory.h"
24 |
25 | #include