Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
libcore: Started removal of Qt dependencies
- Loading branch information
Showing
15 changed files
with
876 additions
and
562 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# c_Plus provides a number of low-level C features. | ||
|
||
set (CPLUS_DIR "" CACHE PATH "Location of the c_Plus library") | ||
|
||
set (_oldPath ${CPLUS_DEFS_H}) | ||
find_file (CPLUS_DEFS_H include/c_plus/defs.h | ||
PATHS "${CPLUS_DIR}" | ||
HINTS ENV DENG_DEPEND_PATH | ||
PATH_SUFFIXES cplus c_plus | ||
NO_DEFAULT_PATH | ||
NO_CMAKE_FIND_ROOT_PATH | ||
) | ||
mark_as_advanced (CPLUS_DEFS_H) | ||
|
||
if (NOT _oldPath STREQUAL CPLUS_DEFS_H) | ||
if (CPLUS_DEFS_H) | ||
message (STATUS "Looking for c_Plus - found") | ||
else () | ||
message (STATUS "Looking for c_Plus - not found (set the CPLUS_DIR variable)") | ||
endif () | ||
endif () | ||
|
||
if (CPLUS_DEFS_H AND NOT TARGET cplus) | ||
get_filename_component (cplusInc "${CPLUS_DEFS_H}" DIRECTORY) | ||
get_filename_component (cplusInc "${cplusInc}" DIRECTORY) | ||
|
||
add_library (cplus INTERFACE) | ||
target_include_directories (cplus INTERFACE ${cplusInc}) | ||
# target_link_libraries (cplus INTERFACE xxx) | ||
endif () | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "data/list.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "data/regexp.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** @file | ||
* | ||
* @authors Copyright (c) 2018 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* LGPL: http://www.gnu.org/licenses/lgpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | ||
* General Public License for more details. You should have received a copy of | ||
* the GNU Lesser General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#ifndef LIBCORE_LIST_H | ||
#define LIBCORE_LIST_H | ||
|
||
#include <vector> | ||
|
||
namespace de { | ||
|
||
/** | ||
* Array of elements. | ||
* @ingroup data | ||
*/ | ||
template <typename T> | ||
class List : public std::vector<T> | ||
{ | ||
using Base = std::vector<T>; | ||
|
||
public: | ||
List() {} | ||
List(const List &); | ||
List(List &&); | ||
List(const std::initializer_list<T> &init) { | ||
for (const auto &i : init) { | ||
push_back(i); | ||
} | ||
} | ||
|
||
using iterator = typename Base::iterator; | ||
using const_iterator = typename Base::const_iterator; | ||
using reverse_iterator = typename Base::reverse_iterator; | ||
using const_reverse_iterator = typename Base::const_reverse_iterator; | ||
|
||
// Qt style methods: | ||
|
||
int size() const { return int(Base::size()); } | ||
void clear() { Base::clear(); } | ||
bool isEmpty() const { return Base::size() == 0; } | ||
void append(const T &s) { Base::push_back(s); } | ||
void prepend(const T &s) { Base::push_front(s); } | ||
void insert(int pos, const T &value) { Base::insert(Base::begin() + pos, value); } | ||
const T &operator[](int pos) const { return Base::at(pos); } | ||
T & operator[](int pos) { return Base::operator[](pos); } | ||
const T &at(int pos) const { return Base::at(pos); } | ||
const T &first() const { return Base::front(); } | ||
const T &last() const { return Base::back(); } | ||
T takeFirst() { T v = first(); Base::pop_front(); return v; } | ||
T takeLast() { T v = last(); Base::pop_back(); return v; } | ||
void removeFirst() { Base::erase(Base::begin()); } | ||
void removeLast() { Base::erase(Base::begin() + size() - 1); } | ||
void removeAt(int pos) { Base::erase(Base::begin() + pos); } | ||
}; | ||
|
||
} // namespace de | ||
|
||
#endif // LIBCORE_LIST_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** @file regexp.h Perl-compatible regular expressions. | ||
* | ||
* @authors Copyright (c) 2018 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* LGPL: http://www.gnu.org/licenses/lgpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | ||
* General Public License for more details. You should have received a copy of | ||
* the GNU Lesser General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#ifndef LIBCORE_REGEXP_H | ||
#define LIBCORE_REGEXP_H | ||
|
||
#include "../String" | ||
#include <c_plus/regexp.h> | ||
|
||
namespace de { | ||
|
||
class RegExpMatch | ||
{ | ||
public: | ||
RegExpMatch(); | ||
|
||
private: | ||
iRegExpMatch _match; | ||
}; | ||
|
||
/** | ||
* Perl-compatible regular expression. | ||
*/ | ||
class RegExp | ||
{ | ||
public: | ||
RegExp(const String &expression = {}, String::CaseSensitivity cs = String::CaseSensitive); | ||
|
||
private: | ||
iRegExp *_d; | ||
}; | ||
|
||
} // namespace de | ||
|
||
#endif // LIBCORE_REGEXP_H |
Oops, something went wrong.