File: ResourceOperation.h

package info (click to toggle)
asymptote 3.02%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 33,400 kB
  • sloc: cpp: 172,516; ansic: 69,728; python: 14,967; sh: 5,599; javascript: 4,866; lisp: 1,507; perl: 1,417; makefile: 1,028; yacc: 610; lex: 449; xml: 182; asm: 8
file content (123 lines) | stat: -rw-r--r-- 2,924 bytes parent folder | download | duplicates (2)
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
122
123
#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`
         */
    optional<bool> overwrite = false;

    /**
         * Ignore if exists.
         */
    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
         */
    optional<CreateFileOptions> options;

    /**
         * An optional annotation identifer describing the operation.
         *
         * @since 3.16.0
         */
    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.
         */
    optional<bool> recursive = false;

    /**
         * Ignore the operation if the file doesn't exist.
         */
    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.
         */
    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.
         */
    optional<RenameFileOptions> options;

    /**
         * An optional annotation identifer describing the operation.
         *
         * @since 3.16.0
         */
    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);