Skip to content

Commit 3e5f699

Browse files
committed
styles: 超级格式化
1 parent 8d5edbb commit 3e5f699

File tree

145 files changed

+1429
-963
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+1429
-963
lines changed

.clang-format

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ AlwaysBreakAfterDefinitionReturnType: None
2929
AlwaysBreakAfterReturnType: None
3030
AlwaysBreakBeforeMultilineStrings: true
3131
AlwaysBreakTemplateDeclarations: Yes
32-
AttributeMacros:
33-
- __pragma
34-
- _Pragma
35-
- __attribute__
36-
- __declspec
32+
# AttributeMacros:
33+
# - __pragma
34+
# - _Pragma
35+
# - __attribute__
36+
# - __declspec
3737
BinPackArguments: false
3838
BinPackParameters: false
3939
BitFieldColonSpacing: After
@@ -136,7 +136,13 @@ PackConstructorInitializers: Never
136136
# PenaltyIndentedWhitespace:
137137
# PenaltyReturnTypeOnItsOwnLine:
138138
PointerAlignment: Left
139-
QualifierAlignment: Leave
139+
QualifierAlignment: Custom
140+
QualifierOrder:
141+
- inline
142+
- static
143+
- const
144+
- constexpr
145+
- type
140146
ReferenceAlignment: Left
141147
ReflowComments: true
142148
RemoveBracesLLVM: false

include/MaaFramework/Instance/MaaController.h

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ extern "C"
3131
* @param callback_arg The callback arg that will be passed to the callback function.
3232
* @return MaaControllerHandle The handle of the created controller instance.
3333
*/
34-
MaaControllerHandle MAA_FRAMEWORK_API MaaAdbControllerCreate( //
35-
MaaStringView adb_path, MaaStringView address, MaaAdbControllerType type, MaaStringView config,
36-
MaaControllerCallback callback, MaaCallbackTransparentArg callback_arg);
34+
MaaControllerHandle MAA_FRAMEWORK_API MaaAdbControllerCreate(
35+
MaaStringView adb_path,
36+
MaaStringView address,
37+
MaaAdbControllerType type,
38+
MaaStringView config,
39+
MaaControllerCallback callback,
40+
MaaCallbackTransparentArg callback_arg);
3741

3842
/**
3943
* @brief Create a win32 controller instance.
@@ -45,8 +49,10 @@ extern "C"
4549
* @param callback_arg The callback arg that will be passed to the callback function.
4650
* @return MaaControllerHandle The handle of the created controller instance.
4751
*/
48-
MaaControllerHandle MAA_FRAMEWORK_API MaaWin32ControllerCreate( //
49-
MaaWin32Hwnd hWnd, MaaWin32ControllerType type, MaaControllerCallback callback,
52+
MaaControllerHandle MAA_FRAMEWORK_API MaaWin32ControllerCreate(
53+
MaaWin32Hwnd hWnd,
54+
MaaWin32ControllerType type,
55+
MaaControllerCallback callback,
5056
MaaCallbackTransparentArg callback_arg);
5157

5258
/**
@@ -61,9 +67,14 @@ extern "C"
6167
* @param callback_arg The callback arg that will be passed to the callback function.
6268
* @return MaaControllerHandle The handle of the created controller instance.
6369
*/
64-
MaaControllerHandle MAA_FRAMEWORK_API MaaAdbControllerCreateV2( //
65-
MaaStringView adb_path, MaaStringView address, MaaAdbControllerType type, MaaStringView config,
66-
MaaStringView agent_path, MaaControllerCallback callback, MaaCallbackTransparentArg callback_arg);
70+
MaaControllerHandle MAA_FRAMEWORK_API MaaAdbControllerCreateV2(
71+
MaaStringView adb_path,
72+
MaaStringView address,
73+
MaaAdbControllerType type,
74+
MaaStringView config,
75+
MaaStringView agent_path,
76+
MaaControllerCallback callback,
77+
MaaCallbackTransparentArg callback_arg);
6778

6879
/**
6980
* @brief Create a custom controller instance.
@@ -74,17 +85,27 @@ extern "C"
7485
* @param callback_arg The callback arg that will be passed to the callback function.
7586
* @return MaaControllerHandle The handle of the created controller instance.
7687
*/
77-
MaaControllerHandle MAA_FRAMEWORK_API MaaCustomControllerCreate( //
78-
MaaCustomControllerHandle handle, MaaTransparentArg handle_arg, MaaControllerCallback callback,
88+
MaaControllerHandle MAA_FRAMEWORK_API MaaCustomControllerCreate(
89+
MaaCustomControllerHandle handle,
90+
MaaTransparentArg handle_arg,
91+
MaaControllerCallback callback,
7992
MaaCallbackTransparentArg callback_arg);
8093

81-
MaaControllerHandle MAA_FRAMEWORK_API MaaThriftControllerCreate( //
82-
MaaThriftControllerType type, MaaStringView host, int32_t port, MaaStringView config,
83-
MaaControllerCallback callback, MaaCallbackTransparentArg callback_arg);
94+
MaaControllerHandle MAA_FRAMEWORK_API MaaThriftControllerCreate(
95+
MaaThriftControllerType type,
96+
MaaStringView host,
97+
int32_t port,
98+
MaaStringView config,
99+
MaaControllerCallback callback,
100+
MaaCallbackTransparentArg callback_arg);
84101

85-
MaaControllerHandle MAA_FRAMEWORK_API MaaDbgControllerCreate( //
86-
MaaStringView read_path, MaaStringView write_path, MaaDbgControllerType type, MaaStringView config,
87-
MaaControllerCallback callback, MaaCallbackTransparentArg callback_arg);
102+
MaaControllerHandle MAA_FRAMEWORK_API MaaDbgControllerCreate(
103+
MaaStringView read_path,
104+
MaaStringView write_path,
105+
MaaDbgControllerType type,
106+
MaaStringView config,
107+
MaaControllerCallback callback,
108+
MaaCallbackTransparentArg callback_arg);
88109

89110
/**
90111
* @brief Free the controller instance.
@@ -105,8 +126,8 @@ extern "C"
105126
* @param val_size The size of the option value.
106127
* @return MaaBool Whether the option is set successfully.
107128
*/
108-
MaaBool MAA_FRAMEWORK_API MaaControllerSetOption(MaaControllerHandle ctrl, MaaCtrlOption key, MaaOptionValue value,
109-
MaaOptionValueSize val_size);
129+
MaaBool MAA_FRAMEWORK_API MaaControllerSetOption(
130+
MaaControllerHandle ctrl, MaaCtrlOption key, MaaOptionValue value, MaaOptionValueSize val_size);
110131

111132
/**
112133
* @defgroup MaaControllerPostRequest Controller Requests
@@ -119,17 +140,17 @@ extern "C"
119140

120141
MaaCtrlId MAA_FRAMEWORK_API MaaControllerPostClick(MaaControllerHandle ctrl, int32_t x, int32_t y);
121142

122-
MaaCtrlId MAA_FRAMEWORK_API MaaControllerPostSwipe(MaaControllerHandle ctrl, int32_t x1, int32_t y1, int32_t x2,
123-
int32_t y2, int32_t duration);
143+
MaaCtrlId MAA_FRAMEWORK_API MaaControllerPostSwipe(
144+
MaaControllerHandle ctrl, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t duration);
124145

125146
MaaCtrlId MAA_FRAMEWORK_API MaaControllerPostPressKey(MaaControllerHandle ctrl, int32_t keycode);
126147

127148
MaaCtrlId MAA_FRAMEWORK_API MaaControllerPostInputText(MaaControllerHandle ctrl, MaaStringView text);
128149

129-
MaaCtrlId MAA_FRAMEWORK_API MaaControllerPostTouchDown(MaaControllerHandle ctrl, int32_t contact, int32_t x,
130-
int32_t y, int32_t pressure);
131-
MaaCtrlId MAA_FRAMEWORK_API MaaControllerPostTouchMove(MaaControllerHandle ctrl, int32_t contact, int32_t x,
132-
int32_t y, int32_t pressure);
150+
MaaCtrlId MAA_FRAMEWORK_API
151+
MaaControllerPostTouchDown(MaaControllerHandle ctrl, int32_t contact, int32_t x, int32_t y, int32_t pressure);
152+
MaaCtrlId MAA_FRAMEWORK_API
153+
MaaControllerPostTouchMove(MaaControllerHandle ctrl, int32_t contact, int32_t x, int32_t y, int32_t pressure);
133154

134155
MaaCtrlId MAA_FRAMEWORK_API MaaControllerPostTouchUp(MaaControllerHandle ctrl, int32_t contact);
135156

include/MaaFramework/Instance/MaaCustomController.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ extern "C"
2525
* You do not have to implement all the functions in this API. Instead, just implement the functions you need.
2626
* Do note that if an unimplemented function is called, the framework will likely crash.
2727
*/
28-
struct MaaCustomControllerAPI
29-
{
28+
struct MaaCustomControllerAPI {
3029
MaaBool (*connect)(MaaTransparentArg handle_arg);
3130

3231
/// Write result to buffer.
3332
MaaBool (*request_uuid)(MaaTransparentArg handle_arg, /* out */ MaaStringBufferHandle buffer);
3433

3534
/// Write result to width and height.
36-
MaaBool (*request_resolution)(MaaTransparentArg handle_arg, /* out */ int32_t* width,
37-
/* out */ int32_t* height);
35+
MaaBool (*request_resolution)(
36+
MaaTransparentArg handle_arg,
37+
/* out */ int32_t* width,
38+
/* out */ int32_t* height);
3839

3940
MaaBool (*start_app)(MaaStringView intent, MaaTransparentArg handle_arg);
4041
MaaBool (*stop_app)(MaaStringView intent, MaaTransparentArg handle_arg);
@@ -43,8 +44,8 @@ extern "C"
4344
MaaBool (*screencap)(MaaTransparentArg handle_arg, /* out */ MaaImageBufferHandle buffer);
4445

4546
MaaBool (*click)(int32_t x, int32_t y, MaaTransparentArg handle_arg);
46-
MaaBool (*swipe)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t duration,
47-
MaaTransparentArg handle_arg);
47+
MaaBool (*swipe)(
48+
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t duration, MaaTransparentArg handle_arg);
4849
MaaBool (*touch_down)(int32_t contact, int32_t x, int32_t y, int32_t pressure, MaaTransparentArg handle_arg);
4950
MaaBool (*touch_move)(int32_t contact, int32_t x, int32_t y, int32_t pressure, MaaTransparentArg handle_arg);
5051
MaaBool (*touch_up)(int32_t contact, MaaTransparentArg handle_arg);

include/MaaFramework/Instance/MaaInstance.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ extern "C"
4545
* @param val_size The size of the option value.
4646
* @return MaaBool Whether the option is set successfully.
4747
*/
48-
MaaBool MAA_FRAMEWORK_API MaaSetOption(MaaInstanceHandle inst, MaaInstOption key, MaaOptionValue value,
49-
MaaOptionValueSize val_size);
48+
MaaBool MAA_FRAMEWORK_API
49+
MaaSetOption(MaaInstanceHandle inst, MaaInstOption key, MaaOptionValue value, MaaOptionValueSize val_size);
5050

5151
/**
5252
* @brief Bind the instance to an initialized resource.
@@ -89,9 +89,11 @@ extern "C"
8989
* @param recognizer_arg
9090
* @return MaaBool
9191
*/
92-
MaaBool MAA_FRAMEWORK_API MaaRegisterCustomRecognizer(MaaInstanceHandle inst, MaaStringView name,
93-
MaaCustomRecognizerHandle recognizer,
94-
MaaTransparentArg recognizer_arg);
92+
MaaBool MAA_FRAMEWORK_API MaaRegisterCustomRecognizer(
93+
MaaInstanceHandle inst,
94+
MaaStringView name,
95+
MaaCustomRecognizerHandle recognizer,
96+
MaaTransparentArg recognizer_arg);
9597

9698
/**
9799
* @brief Unregister a custom recognizer from the instance.
@@ -121,8 +123,8 @@ extern "C"
121123
* @param action_arg
122124
* @return MaaBool
123125
*/
124-
MaaBool MAA_FRAMEWORK_API MaaRegisterCustomAction(MaaInstanceHandle inst, MaaStringView name,
125-
MaaCustomActionHandle action, MaaTransparentArg action_arg);
126+
MaaBool MAA_FRAMEWORK_API MaaRegisterCustomAction(
127+
MaaInstanceHandle inst, MaaStringView name, MaaCustomActionHandle action, MaaTransparentArg action_arg);
126128

127129
/**
128130
* @brief Unregister a custom action from the instance.

include/MaaFramework/Instance/MaaResource.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ extern "C"
2424
* @param callback_arg
2525
* @return MaaResourceHandle
2626
*/
27-
MaaResourceHandle MAA_FRAMEWORK_API MaaResourceCreate(MaaResourceCallback callback,
28-
MaaCallbackTransparentArg callback_arg);
27+
MaaResourceHandle MAA_FRAMEWORK_API
28+
MaaResourceCreate(MaaResourceCallback callback, MaaCallbackTransparentArg callback_arg);
2929

3030
/**
3131
* @brief Free the resource.
@@ -81,8 +81,8 @@ extern "C"
8181
* @param val_size The size of the option value.
8282
* @return MaaBool Whether the option is set successfully.
8383
*/
84-
MaaBool MAA_FRAMEWORK_API MaaResourceSetOption(MaaResourceHandle res, MaaResOption key, MaaOptionValue value,
85-
MaaOptionValueSize val_size);
84+
MaaBool MAA_FRAMEWORK_API MaaResourceSetOption(
85+
MaaResourceHandle res, MaaResOption key, MaaOptionValue value, MaaOptionValueSize val_size);
8686

8787
/**
8888
* @brief Get the hash of the resource.

include/MaaFramework/MaaDef.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,7 @@ extern "C"
272272
{
273273
#endif
274274

275-
typedef struct MaaRect
276-
{
275+
typedef struct MaaRect {
277276
int32_t x;
278277
int32_t y;
279278
int32_t width;

include/MaaFramework/Task/MaaCustomAction.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ extern "C"
2525
* You do not have to implement all the functions in this API. Instead, just implement the functions you need.
2626
* Do note that if an unimplemented function is called, the framework will likely crash.
2727
*/
28-
struct MaaCustomActionAPI
29-
{
30-
MaaBool (*run)(MaaSyncContextHandle sync_context, MaaStringView task_name, MaaStringView custom_action_param,
31-
MaaRectHandle cur_box, MaaStringView cur_rec_detail, MaaTransparentArg action_arg);
28+
struct MaaCustomActionAPI {
29+
MaaBool (*run)(
30+
MaaSyncContextHandle sync_context,
31+
MaaStringView task_name,
32+
MaaStringView custom_action_param,
33+
MaaRectHandle cur_box,
34+
MaaStringView cur_rec_detail,
35+
MaaTransparentArg action_arg);
3236

3337
void (*stop)(MaaTransparentArg action_arg);
3438
};

include/MaaFramework/Task/MaaCustomRecognizer.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@ extern "C"
2525
* You do not have to implement all the functions in this API. Instead, just implement the functions you need.
2626
* Do note that if an unimplemented function is called, the framework will likely crash.
2727
*/
28-
struct MaaCustomRecognizerAPI
29-
{
28+
struct MaaCustomRecognizerAPI {
3029
/// Write the recognition result to the out_box and return true if the recognition is successful.
3130
/// If the recognition fails, return false.
3231
/// You can also write details to the out_detail buffer.
33-
MaaBool (*analyze)(MaaSyncContextHandle sync_context, const MaaImageBufferHandle image, MaaStringView task_name,
34-
MaaStringView custom_recognition_param, MaaTransparentArg recognizer_arg,
35-
/*out*/ MaaRectHandle out_box,
36-
/*out*/ MaaStringBufferHandle out_detail);
32+
MaaBool (*analyze)(
33+
MaaSyncContextHandle sync_context,
34+
const MaaImageBufferHandle image,
35+
MaaStringView task_name,
36+
MaaStringView custom_recognition_param,
37+
MaaTransparentArg recognizer_arg,
38+
/*out*/ MaaRectHandle out_box,
39+
/*out*/ MaaStringBufferHandle out_detail);
3740
};
3841

3942
#ifdef __cplusplus

include/MaaFramework/Task/MaaSyncContext.h

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,39 @@ extern "C"
1717
{
1818
#endif
1919

20-
MaaBool MAA_FRAMEWORK_API MaaSyncContextRunTask(MaaSyncContextHandle sync_context, MaaStringView task_name,
21-
MaaStringView param);
22-
MaaBool MAA_FRAMEWORK_API MaaSyncContextRunRecognizer(MaaSyncContextHandle sync_context, MaaImageBufferHandle image,
23-
MaaStringView task_name, MaaStringView task_param,
24-
MaaRectHandle out_box /**< [out] */,
25-
MaaStringBufferHandle out_detail /**< [out] */);
26-
MaaBool MAA_FRAMEWORK_API MaaSyncContextRunAction(MaaSyncContextHandle sync_context, MaaStringView task_name,
27-
MaaStringView task_param, MaaRectHandle cur_box,
28-
MaaStringView cur_rec_detail);
20+
MaaBool MAA_FRAMEWORK_API
21+
MaaSyncContextRunTask(MaaSyncContextHandle sync_context, MaaStringView task_name, MaaStringView param);
22+
MaaBool MAA_FRAMEWORK_API MaaSyncContextRunRecognizer(
23+
MaaSyncContextHandle sync_context,
24+
MaaImageBufferHandle image,
25+
MaaStringView task_name,
26+
MaaStringView task_param,
27+
MaaRectHandle out_box /**< [out] */,
28+
MaaStringBufferHandle out_detail /**< [out] */);
29+
MaaBool MAA_FRAMEWORK_API MaaSyncContextRunAction(
30+
MaaSyncContextHandle sync_context,
31+
MaaStringView task_name,
32+
MaaStringView task_param,
33+
MaaRectHandle cur_box,
34+
MaaStringView cur_rec_detail);
2935
MaaBool MAA_FRAMEWORK_API MaaSyncContextClick(MaaSyncContextHandle sync_context, int32_t x, int32_t y);
30-
MaaBool MAA_FRAMEWORK_API MaaSyncContextSwipe(MaaSyncContextHandle sync_context, int32_t x1, int32_t y1, int32_t x2,
31-
int32_t y2, int32_t duration);
36+
MaaBool MAA_FRAMEWORK_API MaaSyncContextSwipe(
37+
MaaSyncContextHandle sync_context, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t duration);
3238
MaaBool MAA_FRAMEWORK_API MaaSyncContextPressKey(MaaSyncContextHandle sync_context, int32_t keycode);
3339
MaaBool MAA_FRAMEWORK_API MaaSyncContextInputText(MaaSyncContextHandle sync_context, MaaStringView text);
3440

35-
MaaBool MAA_FRAMEWORK_API MaaSyncContextTouchDown(MaaSyncContextHandle sync_context, int32_t contact, int32_t x,
36-
int32_t y, int32_t pressure);
37-
MaaBool MAA_FRAMEWORK_API MaaSyncContextTouchMove(MaaSyncContextHandle sync_context, int32_t contact, int32_t x,
38-
int32_t y, int32_t pressure);
41+
MaaBool MAA_FRAMEWORK_API MaaSyncContextTouchDown(
42+
MaaSyncContextHandle sync_context, int32_t contact, int32_t x, int32_t y, int32_t pressure);
43+
MaaBool MAA_FRAMEWORK_API MaaSyncContextTouchMove(
44+
MaaSyncContextHandle sync_context, int32_t contact, int32_t x, int32_t y, int32_t pressure);
3945
MaaBool MAA_FRAMEWORK_API MaaSyncContextTouchUp(MaaSyncContextHandle sync_context, int32_t contact);
4046

41-
MaaBool MAA_FRAMEWORK_API MaaSyncContextScreencap(MaaSyncContextHandle sync_context,
42-
MaaImageBufferHandle out_image /**< [out] */);
43-
MaaBool MAA_FRAMEWORK_API MaaSyncContextGetTaskResult(MaaSyncContextHandle sync_context, MaaStringView task_name,
44-
MaaStringBufferHandle out_task_result /**< [out] */);
47+
MaaBool MAA_FRAMEWORK_API
48+
MaaSyncContextScreencap(MaaSyncContextHandle sync_context, MaaImageBufferHandle out_image /**< [out] */);
49+
MaaBool MAA_FRAMEWORK_API MaaSyncContextGetTaskResult(
50+
MaaSyncContextHandle sync_context,
51+
MaaStringView task_name,
52+
MaaStringBufferHandle out_task_result /**< [out] */);
4553

4654
#ifdef __cplusplus
4755
}

include/MaaFramework/Utility/MaaBuffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ extern "C"
3737
int32_t MAA_FRAMEWORK_API MaaGetImageWidth(MaaImageBufferHandle handle);
3838
int32_t MAA_FRAMEWORK_API MaaGetImageHeight(MaaImageBufferHandle handle);
3939
int32_t MAA_FRAMEWORK_API MaaGetImageType(MaaImageBufferHandle handle);
40-
MaaBool MAA_FRAMEWORK_API MaaSetImageRawData(MaaImageBufferHandle handle, MaaImageRawData data, int32_t width,
41-
int32_t height, int32_t type);
40+
MaaBool MAA_FRAMEWORK_API MaaSetImageRawData(
41+
MaaImageBufferHandle handle, MaaImageRawData data, int32_t width, int32_t height, int32_t type);
4242

4343
typedef uint8_t* MaaImageEncodedData;
4444
MaaImageEncodedData MAA_FRAMEWORK_API MaaGetImageEncoded(MaaImageBufferHandle handle);

include/MaaFramework/Utility/MaaUtility.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ extern "C"
3535
* @param val_size The size of the option value.
3636
* @return MaaBool Whether the option is set successfully.
3737
*/
38-
MaaBool MAA_FRAMEWORK_API MaaSetGlobalOption(MaaGlobalOption key, MaaOptionValue value,
39-
MaaOptionValueSize val_size);
38+
MaaBool MAA_FRAMEWORK_API
39+
MaaSetGlobalOption(MaaGlobalOption key, MaaOptionValue value, MaaOptionValueSize val_size);
4040

4141
#ifdef __cplusplus
4242
}

0 commit comments

Comments
 (0)