Skip to content

Commit ae2ff9a

Browse files
committed
update documentation.
1 parent b9aa62d commit ae2ff9a

13 files changed

+236
-110
lines changed

.codedocs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ FILE_PATTERNS =
77
QT_AUTOBRIEF = YES
88
RECURSIVE = YES
99
STRIP_CODE_COMMENTS = NO
10-
EXCLUDE_PATTERNS = "*/src/lib/fcitx-wayland/*" "*/*_p.h
10+
EXCLUDE_PATTERNS = "*/src/lib/fcitx-wayland/*" "*/*_p.h"
1111
ENABLE_PREPROCESSING = YES
1212
MACRO_EXPANSION = YES
1313

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ endif ()
111111

112112
if (ENABLE_DOC)
113113
find_package(Doxygen REQUIRED)
114+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/.codedocs" FCITX_DOXYGEN_CONFIGURATION)
114115
configure_file(
115116
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
116117
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile

Doxyfile.in

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/doc/
2-
INPUT = src/lib
3-
DOXYFILE_ENCODING = UTF-8
4-
PROJECT_NAME = Fcitx
52
PROJECT_NUMBER = @FCITX_VERSION@
6-
OUTPUT_LANGUAGE = English
7-
SOURCE_BROWSER = YES
8-
FILE_PATTERNS =
9-
GENERATE_LATEX = NO
10-
QT_AUTOBRIEF = YES
11-
RECURSIVE = YES
12-
STRIP_CODE_COMMENTS = NO
13-
EXCLUDE_PATTERNS = "*/src/lib/fcitx-wayland/*" "*/*_p.h
14-
ENABLE_PREPROCESSING = YES
15-
MACRO_EXPANSION = YES
163

17-
STRIP_FROM_PATH = @CMAKE_CURRENT_SOURCE_DIR@/src/lib
18-
STRIP_FROM_INC_PATH = @CMAKE_CURRENT_SOURCE_DIR@/src/lib
4+
@FCITX_DOXYGEN_CONFIGURATION@

src/lib/fcitx-utils/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ set(FCITX_UTILS_HEADERS
4545
keysym.h
4646
keysymgen.h
4747
signals.h
48+
signals_details.h
4849
handlertable.h
4950
handlertable_details.h
5051
intrusivelist.h

src/lib/fcitx-utils/key.h

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#ifndef _FCITX_UTILS_KEY_H_
2121
#define _FCITX_UTILS_KEY_H_
2222

23+
/// \addtogroup FcitxUtils
24+
/// \{
25+
/// \file
26+
/// \brief Class to represent a key.
27+
2328
#include "fcitxutils_export.h"
2429
#include <algorithm>
2530
#include <cstdint>

src/lib/fcitx-utils/keysym.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@
2020
#ifndef FCITX_UTILS_KEYSYM_H
2121
#define FCITX_UTILS_KEYSYM_H
2222

23+
/// \addtogroup FcitxUtils
24+
/// \{
25+
/// \file
26+
/// \brief Key sym related types.
27+
2328
#include <cstdint>
2429
#include <fcitx-utils/keysymgen.h>
2530
#include <fcitx-utils/macros.h>
2631

2732
namespace fcitx {
28-
/**
29-
* fcitx key state (modifier keys)
30-
**/
33+
/// \brief KeyState to represent modifier keys.
3134
enum class KeyState : uint32_t {
3235
None = 0,
3336
Shift = 1 << 0,

src/lib/fcitx-utils/library.h

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
#ifndef _FCITX_UTILS_LIBRARY_H_
2020
#define _FCITX_UTILS_LIBRARY_H_
2121

22+
/// \addtogroup FcitxUtils
23+
/// \{
24+
/// \file
25+
/// \brief Class to handler dynamic library.
26+
2227
#include "fcitxutils_export.h"
2328
#include <fcitx-utils/flags.h>
2429
#include <fcitx-utils/macros.h>

src/lib/fcitx-utils/log.h

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
#ifndef _FCITX_UTILS_LOG_H_
2020
#define _FCITX_UTILS_LOG_H_
2121

22+
/// \addtogroup FcitxUtils
23+
/// \{
24+
/// \file
25+
/// \brief Log utilities.
26+
2227
#include "fcitxutils_export.h"
2328
#include <cstdlib>
2429
#include <fcitx-utils/fs.h>
@@ -29,6 +34,7 @@
2934

3035
namespace fcitx {
3136

37+
/// \brief LogLevel from high to low.
3238
enum LogLevel : int {
3339
None = 0,
3440
Fatal = 1,

src/lib/fcitx-utils/metastring.h

+7
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@
1919
#ifndef _FCITX_UTILS_METASTRING_H_
2020
#define _FCITX_UTILS_METASTRING_H_
2121

22+
/// \addtogroup FcitxUtils
23+
/// \{
24+
/// \file
25+
/// \brief Static string based on template argument.
26+
2227
#include <exception>
2328

2429
namespace fcitx {
2530

31+
2632
template <char... c>
2733
struct MetaString final {
2834
public:
@@ -135,6 +141,7 @@ struct MetaStringTrim {
135141
FCITX_METASTRING_TEMPLATE_16(N##E, S), \
136142
FCITX_METASTRING_TEMPLATE_16(N##F, S)
137143

144+
/// \brief Create meta string from string literal.
138145
#define fcitxMakeMetaString(STRING) \
139146
::fcitx::MetaStringTrim<FCITX_METASTRING_TEMPLATE_256(, STRING)>::type
140147
}

src/lib/fcitx-utils/rect.h

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
#ifndef _FCITX_UTILS_RECT_H_
2020
#define _FCITX_UTILS_RECT_H_
2121

22+
/// \addtogroup FcitxUtils
23+
/// \{
24+
/// \file
25+
/// \brief Provide utility to handle rectangle.
26+
2227
#include "fcitxutils_export.h"
2328

2429
namespace fcitx {

src/lib/fcitx-utils/signals.h

+19-86
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,22 @@
1919
#ifndef _FCITX_UTILS_SIGNALS_H_
2020
#define _FCITX_UTILS_SIGNALS_H_
2121

22+
/// \addtogroup FcitxUtils
23+
/// \{
24+
/// \file
25+
/// \brief A signal-slot implemention.
26+
2227
#include <fcitx-utils/handlertable.h>
2328
#include <fcitx-utils/intrusivelist.h>
2429
#include <fcitx-utils/macros.h>
2530
#include <fcitx-utils/trackableobject.h>
2631
#include <fcitx-utils/tuplehelpers.h>
32+
#include <fcitx-utils/signals_details.h>
2733
#include <tuple>
2834

2935
namespace fcitx {
3036

37+
/// \brief Combiner that return the last value.
3138
template <typename T>
3239
class LastValue {
3340
public:
@@ -45,6 +52,7 @@ class LastValue {
4552
private:
4653
T initial_;
4754
};
55+
4856
template <>
4957
class LastValue<void> {
5058
public:
@@ -57,90 +65,8 @@ class LastValue<void> {
5765
}
5866
};
5967

60-
template <typename Ret, typename... Args>
61-
class Invoker {
62-
public:
63-
Invoker(Args &... args) : args_(args...) {}
64-
65-
template <typename Func>
66-
Ret operator()(Func &func) {
67-
return callWithTuple(func, args_);
68-
}
69-
70-
private:
71-
std::tuple<Args &...> args_;
72-
};
73-
74-
template <typename T>
75-
class SlotInvokeIterator;
76-
77-
template <typename Ret, typename... Args>
78-
class SlotInvokeIterator<std::function<Ret(Args...)>> {
79-
public:
80-
typedef std::input_iterator_tag iterator_category;
81-
typedef std::function<Ret(Args...)> function_type;
82-
typedef typename function_type::result_type value_type;
83-
typedef std::ptrdiff_t difference_type;
84-
typedef value_type reference;
85-
typedef typename HandlerTableView<function_type>::iterator super_iterator;
86-
typedef SlotInvokeIterator iterator;
87-
typedef Invoker<Ret, Args...> invoker_type;
88-
89-
SlotInvokeIterator(invoker_type &invoker, super_iterator iter)
90-
: parentIter_(iter), invoker_(invoker) {}
91-
92-
SlotInvokeIterator(const iterator &other) = default;
93-
94-
iterator &operator=(const iterator &other) = default;
95-
96-
bool operator==(const iterator &other) const noexcept {
97-
return parentIter_ == other.parentIter_;
98-
}
99-
bool operator!=(const iterator &other) const noexcept {
100-
return !operator==(other);
101-
}
102-
103-
iterator &operator++() {
104-
parentIter_++;
105-
return *this;
106-
}
107-
108-
iterator operator++(int) {
109-
auto old = parentIter_;
110-
++(*this);
111-
return {invoker_, old};
112-
}
113-
114-
reference operator*() { return invoker_(*parentIter_); }
115-
116-
private:
117-
super_iterator parentIter_;
118-
invoker_type &invoker_;
119-
};
120-
121-
template <typename Invoker, typename Iter>
122-
SlotInvokeIterator<typename Iter::value_type>
123-
MakeSlotInvokeIterator(Invoker invoker, Iter iter) {
124-
return {invoker, iter};
125-
}
126-
127-
template <typename T,
128-
typename Combiner = LastValue<typename std::function<T>::result_type>>
129-
class Signal;
130-
131-
class ConnectionBody : public TrackableObject<ConnectionBody>,
132-
public IntrusiveListNode {
133-
public:
134-
template <typename T>
135-
ConnectionBody(HandlerTableEntry<T> *entry) : entry_(entry) {}
136-
137-
virtual ~ConnectionBody() { remove(); }
138-
139-
private:
140-
// Need type erasure here
141-
std::shared_ptr<void> entry_;
142-
};
143-
68+
/// \brief A connection instance. Can be used to query the existence of
69+
/// connection.
14470
class Connection {
14571
public:
14672
Connection() {}
@@ -165,6 +91,8 @@ class Connection {
16591
TrackableObjectReference<ConnectionBody> body_;
16692
};
16793

94+
/// \brief Connection that will disconnection when it goes out of scope.
95+
/// \see Connection
16896
class ScopedConnection : public Connection {
16997
public:
17098
// You must create two Connection if you really want two ScopedConnection
@@ -194,9 +122,14 @@ class ScopedConnection : public Connection {
194122

195123
class SignalBase {
196124
public:
197-
virtual ~SignalBase() {}
125+
virtual ~SignalBase() = default;
198126
};
199127

128+
/// \brief Class to represent a signal. May be used like a functor.
129+
template <typename T,
130+
typename Combiner = LastValue<typename std::function<T>::result_type>>
131+
class Signal;
132+
200133
template <typename Ret, typename Combiner, typename... Args>
201134
class Signal<Ret(Args...), Combiner> : public SignalBase {
202135
struct SignalData {
@@ -217,7 +150,7 @@ class Signal<Ret(Args...), Combiner> : public SignalBase {
217150
disconnectAll();
218151
}
219152
}
220-
Signal(Signal &&other) noexcept { operator=(std::forward<Signal>(other)); }
153+
Signal(Signal &&other) noexcept { operator=(std::move<Signal>(other)); }
221154
Signal &operator=(Signal &&other) noexcept {
222155
using std::swap;
223156
swap(d_ptr, other.d_ptr);

0 commit comments

Comments
 (0)