summaryrefslogtreecommitdiff
path: root/graphics/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h
blob: caf2ea5d5fd6a79dd380908f5ceddbb769af2fa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#pragma once

#include "LibLsp/JsonRpc/serializer.h"
#include <vector>
#include "lsDocumentUri.h"
#include "LibLsp/lsp/lsAny.h"
#include "LibLsp/lsp/lsTextEdit.h"
struct ResourceOperation {
	std::string kind;
	virtual  ~ResourceOperation() = default;
	
	MAKE_SWAP_METHOD(ResourceOperation, kind);
};
MAKE_REFLECT_STRUCT(ResourceOperation, kind);
extern void Reflect(Writer& visitor, ResourceOperation* value);
struct CreateFileOptions{

	/**
	 * Overwrite existing file. Overwrite wins over `ignoreIfExists`
	 */
	boost::optional<bool>  overwrite = false;

	/**
	 * Ignore if exists.
	 */
	boost::optional< bool> ignoreIfExists =false;
	
	MAKE_SWAP_METHOD(CreateFileOptions, overwrite, ignoreIfExists)
};
MAKE_REFLECT_STRUCT(CreateFileOptions, overwrite, ignoreIfExists)
struct lsCreateFile :public ResourceOperation {

	/**
	 * The resource to create.
	 */
	lsCreateFile();
	lsDocumentUri uri;

	/**
	 * Additional options
	 */
	boost::optional<CreateFileOptions>  options;


	/**
	 * An optional annotation identifer describing the operation.
	 *
	 * @since 3.16.0
	 */
	boost::optional<lsChangeAnnotationIdentifier> annotationId;
	
	MAKE_SWAP_METHOD(lsCreateFile, kind, uri, options, annotationId)
};
MAKE_REFLECT_STRUCT(lsCreateFile, kind, uri,options, annotationId)


struct DeleteFileOptions {
	/**
	 * Delete the content recursively if a folder is denoted.
	 */
	boost::optional<bool>  recursive = false;

	/**
	 * Ignore the operation if the file doesn't exist.
	 */
	boost::optional<bool> ignoreIfNotExists = false;


	MAKE_SWAP_METHOD(DeleteFileOptions, recursive, ignoreIfNotExists);
};

MAKE_REFLECT_STRUCT(DeleteFileOptions, recursive, ignoreIfNotExists)

struct lsDeleteFile :public ResourceOperation {
	/**
	 * The file to delete.
	 */
	lsDeleteFile();
	lsDocumentUri uri;

	/**
	 * Delete options.
	 */
	boost::optional<DeleteFileOptions>  options;

	MAKE_SWAP_METHOD(lsDeleteFile, kind, uri, options);
};
MAKE_REFLECT_STRUCT(lsDeleteFile, kind, uri,options);

typedef  CreateFileOptions RenameFileOptions;
struct lsRenameFile :public ResourceOperation {
	/**
	 * The old (existing) location.
	 */
	lsRenameFile();
	lsDocumentUri oldUri;

	/**
	 * The new location.
	 */

	lsDocumentUri newUri;

	/**
	 * Rename options.
	 */
	boost::optional<RenameFileOptions>  options;

	/**
	 * An optional annotation identifer describing the operation.
	 *
	 * @since 3.16.0
	 */
	boost::optional<lsChangeAnnotationIdentifier> annotationId;
	
	MAKE_SWAP_METHOD(lsRenameFile, kind, oldUri, newUri, options, annotationId)
};
MAKE_REFLECT_STRUCT(lsRenameFile, kind, oldUri, newUri, options, annotationId);


extern  ResourceOperation* GetResourceOperation(lsp::Any& lspAny);