Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #5

Merged
merged 3 commits into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions TTKModule/TTKText/TTKChardet/checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ CheckerBase::CheckerBase(const string &name)

}

CheckerBase::~CheckerBase()
{

}
2 changes: 2 additions & 0 deletions TTKModule/TTKText/TTKChardet/checker.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class TTK_CORE_EXPORT CheckerBase
{
public:
CheckerBase(const string &name);
virtual ~CheckerBase();

virtual bool detect(const string &str) const = 0;

private:
Expand Down
23 changes: 23 additions & 0 deletions ttkglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@
# define TTK_NO_WINEXTRAS
#endif

#ifndef qPrintable
#define qPrintable(s) QString(s).toLocal8Bit().constData()
#endif

#ifndef qUtf8Printable
#define qUtf8Printable(s) QString(s).toUtf8().constData()
#endif

#if !TTK_QT_VERSION_CHECK(5,7,0)
#define TTK_AS_CONST
// this adds const to non-const objects (like std::as_const)
#ifndef Q_CC_MSVC
template <typename T>
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
// prevent rvalue arguments:
template <typename T>
void qAsConst(const T &&) = delete;
#else
template <typename T>
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) { return t; }
#endif
#endif

//
#ifdef QT_DEBUG
# define TTK_DEBUG
Expand Down
14 changes: 10 additions & 4 deletions ttkprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@
================================================= */


#define TTK_CREATE_PRIVATE(Class) (*new Class##Private)

#define TTK_DECLARE_PRIVATE(Class) \
friend class Class##Private; \
TTKPrivateInterface<Class, Class##Private> ttk_d;

#define TTK_DECLARE_PUBLIC(Class) \
friend class Class;

#define TTK_INIT_PRIVATE \
#define TTK_INIT_PRIVATE(Class) \
ttk_d.setPrivate(new Class##Private); \
ttk_d.setPublic(this);

#define TTK_INIT_PUBLIC(Class) \
ttk_d.setPrivate(new Class##Private);
#define TTK_INIT_PRIVATE_D(PVT) \
ttk_d.setPrivate(&PVT); \
ttk_d.setPublic(this);

#define TTK_D(Class) Class##Private *const d = static_cast<Class##Private *>(ttk_d())
#define TTK_Q(Class) Class *const q = static_cast<Class *>(ttk_q())
Expand All @@ -45,6 +49,7 @@ class TTKPrivate
public:
TTKPrivate() { ttk_q_ptr = nullptr; }
virtual ~TTKPrivate() { }

inline void setPublic(PUB* pub) { ttk_q_ptr = pub; }

protected:
Expand All @@ -63,7 +68,8 @@ class TTKPrivateInterface
{
friend class TTKPrivate<PUB>;
public:
TTKPrivateInterface() { pvt_ptr = new PVT; }
TTKPrivateInterface(PVT* pvt) : pvt_ptr(pvt) { }
TTKPrivateInterface() : pvt_ptr(nullptr) { }
~TTKPrivateInterface() { delete pvt_ptr; }

inline void setPrivate(PVT* pvt) { delete pvt_ptr; pvt_ptr = pvt; }
Expand Down