Skip to content

Commit da6f8b9

Browse files
Merge branch 'Project'
2 parents 928e152 + 4f57a85 commit da6f8b9

File tree

5 files changed

+179
-1
lines changed

5 files changed

+179
-1
lines changed

smcore/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
3030

3131
set(SMCORE_INCLUDE
3232
about.h
33+
error.h
3334
factory.h
3435
license.h
3536
options.h
36-
smstring.h
37+
project.h
38+
smcore_global.h
3739
)
3840

3941
set(SMCORE_BODY
4042
about.cpp
43+
error.cpp
4144
factory.cpp
4245
license.cpp
4346
options.cpp

smcore/error.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
}

smcore/error.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 <QString>
26+
#include "smcore_global.h"
27+
28+
// See error class in C++ with enum
29+
// https://stackoverflow.com/questions/21295935/can-a-c-enum-class-have-methods
30+
// And how to convert enum to string
31+
// https://stackoverflow.com/questions/28828957/enum-to-string-in-modern-c11-c14-c17-and-future-c20
32+
33+
namespace smos
34+
{
35+
namespace smcore
36+
{
37+
class SMCORE_EXPORT Error
38+
{
39+
public:
40+
enum ErrorCode
41+
{
42+
ERR_EVERYTHING_OK = 0,
43+
ERR_PROJECT_DOES_NOT_EXIST,
44+
ERR_PROJECT_INVALID,
45+
};
46+
};
47+
}
48+
}

smcore/project.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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 "project.h"
24+
#include <filesystem>
25+
26+
namespace smos
27+
{
28+
namespace smcore
29+
{
30+
//******************************************************************************
31+
Project::Project(void)
32+
{
33+
}
34+
//******************************************************************************
35+
smos::smcore::Error::ErrorCode Project::loadProject(QString filename)
36+
{
37+
if (!std::filesystem::exists(filename.toStdString()))
38+
{
39+
return smos::smcore::Error::ERR_PROJECT_DOES_NOT_EXIST;
40+
}
41+
return smos::smcore::Error::ERR_EVERYTHING_OK;
42+
}
43+
}
44+
}

smcore/project.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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 <QString>
26+
#include "smcore_global.h"
27+
#include "error.h"
28+
29+
namespace smos
30+
{
31+
namespace smcore
32+
{
33+
class SMCORE_EXPORT Project
34+
{
35+
public:
36+
/**
37+
* @brief Construct a new Project object
38+
*
39+
*/
40+
Project(void);
41+
42+
/**
43+
* @brief Load project data
44+
*
45+
* @param filename Name of project file
46+
*
47+
* @return smos::smcore::Error::ErrorCode
48+
*/
49+
smos::smcore::Error::ErrorCode loadProject(QString filename);
50+
};
51+
}
52+
}

0 commit comments

Comments
 (0)