Audacity 3.2.0
Functions
audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp} Namespace Reference

Functions

bool Deserialize (const rapidjson::Value &value, std::string &result)
 
bool Deserialize (const rapidjson::Value &value, int &result)
 
bool Deserialize (const rapidjson::Value &value, long &result)
 
bool Deserialize (const rapidjson::Value &value, long long &result)
 
bool Deserialize (const rapidjson::Value &value, bool &result)
 
template<typename T >
bool Deserialize (const rapidjson::Value &value, std::string_view zKey, T &result)
 
template<typename T >
bool DeserializeArray (const rapidjson::Value &value, std::vector< T > &result)
 
template<typename T >
bool DeserializeArray (const rapidjson::Value &value, std::string_view zKey, std::vector< T > &result)
 
bool Deserialize (const rapidjson::Value &value, UploadUrls &urls)
 
bool Deserialize (const rapidjson::Value &value, VersionInfo &urls)
 
bool Deserialize (const rapidjson::Value &value, SnapshotBlockInfo &urls)
 
bool Deserialize (const rapidjson::Value &value, SnapshotInfo &snapshotInfo)
 
bool Deserialize (const rapidjson::Value &value, ProjectInfo &projectInfo)
 
bool Deserialize (const rapidjson::Value &value, ProjectSyncState &urls)
 
bool Deserialize (const rapidjson::Value &value, CreateSnapshotResponse &reponse)
 
bool Deserialize (const rapidjson::Value &value, PaginationInfo &info)
 
bool Deserialize (const rapidjson::Value &value, PaginatedProjectsResponse &response)
 
template<typename T >
bool Deserialize (std::string_view data, T &result)
 
wxString SafeName (wxString name)
 

Function Documentation

◆ Deserialize() [1/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
bool &  result 
)

Definition at line 74 of file CloudSyncDTO.cpp.

75{
76 if (!value.IsBool())
77 return false;
78
79 result = value.GetBool();
80
81 return true;
82}

◆ Deserialize() [2/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
CreateSnapshotResponse reponse 
)

Definition at line 267 of file CloudSyncDTO.cpp.

268{
269 if (!value.IsObject())
270 return {};
271
272 CreateSnapshotResponse tempResponse;
273
274 if (!Deserialize(value, "project", tempResponse.Project))
275 return {};
276
277 if (!Deserialize(value, "snapshot", tempResponse.Snapshot))
278 return {};
279
280 if (!Deserialize(value, "sync", tempResponse.SyncState))
281 return {};
282
283 reponse = std::move(tempResponse);
284
285 return true;
286}

References Deserialize(), audacity::cloud::audiocom::sync::CreateSnapshotResponse::Project, audacity::cloud::audiocom::sync::CreateSnapshotResponse::Snapshot, and audacity::cloud::audiocom::sync::CreateSnapshotResponse::SyncState.

Here is the call graph for this function:

◆ Deserialize() [3/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
int &  result 
)

Definition at line 41 of file CloudSyncDTO.cpp.

42{
43 if (!value.IsInt64())
44 return false;
45
46 result = value.GetInt();
47
48 return true;
49}

◆ Deserialize() [4/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
long &  result 
)

Definition at line 51 of file CloudSyncDTO.cpp.

52{
53 if (!value.IsInt64())
54 return false;
55
56 if (sizeof(long) == sizeof(int64_t))
57 result = value.GetInt64();
58 else
59 result = value.GetInt();
60
61 return true;
62}

◆ Deserialize() [5/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
long long &  result 
)

Definition at line 64 of file CloudSyncDTO.cpp.

65{
66 if (!value.IsInt64())
67 return false;
68
69 result = value.GetInt64();
70
71 return true;
72}

◆ Deserialize() [6/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
PaginatedProjectsResponse response 
)

Definition at line 312 of file CloudSyncDTO.cpp.

314{
315 if (!value.IsObject())
316 return {};
317
318 PaginatedProjectsResponse tempResponse;
319
320 if (!DeserializeArray(value, "items", tempResponse.Items))
321 return {};
322
323 if (!Deserialize(value, "pagination", tempResponse.Pagination))
324 return {};
325
326 response = std::move(tempResponse);
327
328 return true;
329}
bool DeserializeArray(const rapidjson::Value &value, std::string_view zKey, std::vector< T > &result)

References Deserialize(), DeserializeArray(), audacity::cloud::audiocom::sync::PaginatedProjectsResponse::Items, and audacity::cloud::audiocom::sync::PaginatedProjectsResponse::Pagination.

Here is the call graph for this function:

◆ Deserialize() [7/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
PaginationInfo info 
)

Definition at line 288 of file CloudSyncDTO.cpp.

289{
290 if (!value.IsObject())
291 return {};
292
293 PaginationInfo tempInfo;
294
295 if (!Deserialize(value, "total", tempInfo.TotalCount))
296 return {};
297
298 if (!Deserialize(value, "pages", tempInfo.PagesCount))
299 return {};
300
301 if (!Deserialize(value, "page", tempInfo.CurrentPage))
302 return {};
303
304 if (!Deserialize(value, "size", tempInfo.PageSize))
305 return {};
306
307 info = std::move(tempInfo);
308
309 return true;
310}

References audacity::cloud::audiocom::sync::PaginationInfo::CurrentPage, Deserialize(), audacity::cloud::audiocom::sync::PaginationInfo::PagesCount, audacity::cloud::audiocom::sync::PaginationInfo::PageSize, and audacity::cloud::audiocom::sync::PaginationInfo::TotalCount.

Here is the call graph for this function:

◆ Deserialize() [8/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
ProjectInfo projectInfo 
)

Definition at line 206 of file CloudSyncDTO.cpp.

207{
208 if (!value.IsObject())
209 return {};
210
211 ProjectInfo tempProject;
212
213 if (!Deserialize(value, "id", tempProject.Id))
214 return {};
215
216 if (!Deserialize(value, "username", tempProject.Username))
217 return {};
218
219 if (!Deserialize(value, "author_name", tempProject.AuthorName))
220 return {};
221
222 if (!Deserialize(value, "slug", tempProject.Slug))
223 return {};
224
225 if (!Deserialize(value, "name", tempProject.Name))
226 return {};
227
228 if (!Deserialize(value, "details", tempProject.Details))
229 return {};
230
231 if (!Deserialize(value, "date_created", tempProject.Created))
232 return {};
233
234 if (!Deserialize(value, "date_updated", tempProject.Updated))
235 return {};
236
237 Deserialize(value, "head", tempProject.HeadSnapshot);
239 value, "latest_synced_snapshot_id", tempProject.LastSyncedSnapshotId);
240
241 projectInfo = std::move(tempProject);
242
243 return true;
244}

References audacity::cloud::audiocom::sync::ProjectInfo::AuthorName, audacity::cloud::audiocom::sync::ProjectInfo::Created, Deserialize(), audacity::cloud::audiocom::sync::ProjectInfo::Details, audacity::cloud::audiocom::sync::ProjectInfo::HeadSnapshot, audacity::cloud::audiocom::sync::ProjectInfo::Id, audacity::cloud::audiocom::sync::ProjectInfo::LastSyncedSnapshotId, audacity::cloud::audiocom::sync::ProjectInfo::Name, audacity::cloud::audiocom::sync::ProjectInfo::Slug, audacity::cloud::audiocom::sync::ProjectInfo::Updated, and audacity::cloud::audiocom::sync::ProjectInfo::Username.

Here is the call graph for this function:

◆ Deserialize() [9/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
ProjectSyncState urls 
)

Definition at line 246 of file CloudSyncDTO.cpp.

247{
248 if (!value.IsObject())
249 return {};
250
251 ProjectSyncState tempState;
252
253 if (!Deserialize(value, "mixdown", tempState.MixdownUrls))
254 return {};
255
256 if (!Deserialize(value, "file", tempState.FileUrls))
257 return {};
258
259 if (!DeserializeArray(value, "blocks", tempState.MissingBlocks))
260 return {};
261
262 urls = std::move(tempState);
263
264 return true;
265}

References Deserialize(), DeserializeArray(), audacity::cloud::audiocom::sync::ProjectSyncState::FileUrls, audacity::cloud::audiocom::sync::ProjectSyncState::MissingBlocks, and audacity::cloud::audiocom::sync::ProjectSyncState::MixdownUrls.

Here is the call graph for this function:

◆ Deserialize() [10/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
SnapshotBlockInfo urls 
)

Definition at line 152 of file CloudSyncDTO.cpp.

153{
154 if (!value.IsObject())
155 return {};
156
157 SnapshotBlockInfo tempBlock;
158
159 if (!Deserialize(value, "hash", tempBlock.Hash))
160 return {};
161
162 if (!Deserialize(value, "url", tempBlock.Url))
163 return {};
164
165 urls = std::move(tempBlock);
166
167 return true;
168}

References Deserialize(), audacity::cloud::audiocom::sync::SnapshotBlockInfo::Hash, and audacity::cloud::audiocom::sync::SnapshotBlockInfo::Url.

Here is the call graph for this function:

◆ Deserialize() [11/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
SnapshotInfo snapshotInfo 
)

Definition at line 170 of file CloudSyncDTO.cpp.

171{
172 if (!value.IsObject())
173 return {};
174
175 SnapshotInfo tempSnapshot;
176
177 if (!Deserialize(value, "id", tempSnapshot.Id))
178 return {};
179
180 if (!Deserialize(value, "parent_id", tempSnapshot.ParentId))
181 return {};
182
183 if (!Deserialize(value, "date_created", tempSnapshot.Created))
184 return {};
185
186 if (!Deserialize(value, "date_updated", tempSnapshot.Updated))
187 return {};
188
189 if (!Deserialize(value, "date_synced", tempSnapshot.Synced))
190 return {};
191
192 if (!Deserialize(value, "file_size", tempSnapshot.FileSize))
193 return {};
194
195 if (!Deserialize(value, "blocks_size", tempSnapshot.BlocksSize))
196 return {};
197
198 Deserialize(value, "file_url", tempSnapshot.FileUrl);
199 DeserializeArray(value, "blocks", tempSnapshot.Blocks);
200
201 snapshotInfo = std::move(tempSnapshot);
202
203 return true;
204}
std::vector< SnapshotBlockInfo > Blocks
Definition: CloudSyncDTO.h:89

References audacity::cloud::audiocom::sync::SnapshotInfo::Blocks, audacity::cloud::audiocom::sync::SnapshotInfo::BlocksSize, audacity::cloud::audiocom::sync::SnapshotInfo::Created, Deserialize(), DeserializeArray(), audacity::cloud::audiocom::sync::SnapshotInfo::FileSize, audacity::cloud::audiocom::sync::SnapshotInfo::FileUrl, audacity::cloud::audiocom::sync::SnapshotInfo::Id, audacity::cloud::audiocom::sync::SnapshotInfo::ParentId, audacity::cloud::audiocom::sync::SnapshotInfo::Synced, and audacity::cloud::audiocom::sync::SnapshotInfo::Updated.

Here is the call graph for this function:

◆ Deserialize() [12/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
std::string &  result 
)

Definition at line 31 of file CloudSyncDTO.cpp.

32{
33 if (!value.IsString())
34 return false;
35
36 result = value.GetString();
37
38 return true;
39}

◆ Deserialize() [13/16]

template<typename T >
bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
std::string_view  zKey,
T &  result 
)

Definition at line 332 of file CloudSyncDTO.cpp.

334{
335 if (!value.IsObject() || !value.HasMember(zKey.data()))
336 return false;
337
338 return Deserialize(value[zKey.data()], result);
339}

References Deserialize().

Here is the call graph for this function:

◆ Deserialize() [14/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
UploadUrls urls 
)

Definition at line 101 of file CloudSyncDTO.cpp.

102{
103 if (!value.IsObject())
104 return {};
105
106 UploadUrls tempUrls;
107
108 if (!Deserialize(value, "id", tempUrls.Id))
109 return {};
110
111 if (!Deserialize(value, "url", tempUrls.UploadUrl))
112 return {};
113
114 if (!Deserialize(value, "success", tempUrls.SuccessUrl))
115 return {};
116
117 if (!Deserialize(value, "fail", tempUrls.FailUrl))
118 return {};
119
120 urls = std::move(tempUrls);
121
122 return true;
123}

References Deserialize(), audacity::cloud::audiocom::sync::UploadUrls::FailUrl, audacity::cloud::audiocom::sync::UploadUrls::Id, audacity::cloud::audiocom::sync::UploadUrls::SuccessUrl, and audacity::cloud::audiocom::sync::UploadUrls::UploadUrl.

Here is the call graph for this function:

◆ Deserialize() [15/16]

bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( const rapidjson::Value &  value,
VersionInfo urls 
)

Definition at line 125 of file CloudSyncDTO.cpp.

126{
127 if (!value.IsObject())
128 return {};
129
130 VersionInfo tempVersion;
131
132 if (!Deserialize(value, "id", tempVersion.Id))
133 return {};
134
135 if (!Deserialize(value, "name", tempVersion.Name))
136 return {};
137
138 if (!Deserialize(value, "snapshot_id", tempVersion.SnapshotId))
139 return {};
140
141 if (!Deserialize(value, "date_created", tempVersion.Created))
142 return {};
143
144 if (!Deserialize(value, "date_updated", tempVersion.Updated))
145 return {};
146
147 urls = std::move(tempVersion);
148
149 return true;
150}

References audacity::cloud::audiocom::sync::VersionInfo::Created, Deserialize(), audacity::cloud::audiocom::sync::VersionInfo::Id, audacity::cloud::audiocom::sync::VersionInfo::Name, audacity::cloud::audiocom::sync::VersionInfo::SnapshotId, and audacity::cloud::audiocom::sync::VersionInfo::Updated.

Here is the call graph for this function:

◆ Deserialize() [16/16]

template<typename T >
bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::Deserialize ( std::string_view  data,
T &  result 
)

Definition at line 364 of file CloudSyncDTO.cpp.

365{
366 rapidjson::Document document;
367 document.Parse(data.data(), data.size());
368
369 if (document.HasParseError())
370 return false;
371
372 return Deserialize(document, result);
373}

References Deserialize().

Referenced by Deserialize(), DeserializeArray(), audacity::cloud::audiocom::sync::DeserializeCreateSnapshotResponse(), audacity::cloud::audiocom::sync::DeserializePaginatedProjectsResponse(), audacity::cloud::audiocom::sync::DeserializeProjectInfo(), audacity::cloud::audiocom::sync::DeserializeProjectSyncState(), and audacity::cloud::audiocom::sync::DeserializeSnapshotInfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeserializeArray() [1/2]

template<typename T >
bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::DeserializeArray ( const rapidjson::Value &  value,
std::string_view  zKey,
std::vector< T > &  result 
)

Definition at line 92 of file CloudSyncDTO.cpp.

94{
95 if (!value.IsObject() || !value.HasMember(zKey.data()))
96 return false;
97
98 return DeserializeArray(value[zKey.data()], result);
99}

References DeserializeArray().

Referenced by Deserialize(), and DeserializeArray().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeserializeArray() [2/2]

template<typename T >
bool audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::DeserializeArray ( const rapidjson::Value &  value,
std::vector< T > &  result 
)

Definition at line 342 of file CloudSyncDTO.cpp.

343{
344 if (!value.IsArray())
345 return false;
346
347 result.clear();
348 result.reserve(value.Size());
349
350 for (const auto& item : value.GetArray())
351 {
352 T value;
353
354 if (!Deserialize(item, value))
355 return false;
356
357 result.push_back(std::move(value));
358 }
359
360 return true;
361}

References Deserialize().

Here is the call graph for this function:

◆ SafeName()

wxString audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncDTO.cpp}::SafeName ( wxString  name)

Definition at line 465 of file CloudSyncDTO.cpp.

466{
467 static const std::unordered_set<wxChar> invalidChars {
468 L'/', L'\\', L':', L'*', L'?', L'"', L'\'', L'<', L'>', L'|', L'@',
469 L'&', '$', L'%', L'^', L';', L'~', L'`', L'[', L']', L'{', L'}',
470 };
471
472 for (size_t i = 0; i < name.length(); ++i)
473 {
474 if (invalidChars.find(name[i]) != invalidChars.end())
475 name[i] = wxT('_');
476 }
477
478 return name;
479}
wxT("CloseDown"))
wxString name
Definition: TagsEditor.cpp:166

References name, and wxT().

Referenced by audacity::cloud::audiocom::sync::MakeSafeProjectPath().

Here is the call graph for this function:
Here is the caller graph for this function: