Debian Codegraph @

src/xml/S3MultiPartInitiationParser.cpp

raw
1 /*
2 * This File is part of Davix, The IO library for HTTP based protocols
3 * Copyright (C) CERN 2018
4 * Author: Georgios Bitzes <[email protected]>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22 #include "S3MultiPartInitiationParser.hpp"
23
24 namespace Davix {
25
26 S3MultiPartInitiationParser::S3MultiPartInitiationParser() : nextIsUploadId(false) {
27
28 }
29
30 S3MultiPartInitiationParser::~S3MultiPartInitiationParser(){
31 }
32
33
34 int S3MultiPartInitiationParser::parserStartElemCb(int parent, const char *nspace, const char *name, const char **atts){
35 (void) parent;
36 (void) nspace;
37 (void) atts;
38
39 if(std::string(name) == "UploadId") {
40 nextIsUploadId = true;
41 }
42
43 return 1;
44 }
45
46 int S3MultiPartInitiationParser::parserCdataCb(int state, const char *cdata, size_t len){
47 (void) state;
48 (void) len;
49 (void) cdata;
50
51 if(nextIsUploadId) {
52 uploadId = std::string(cdata, len);
53 nextIsUploadId = false;
54 }
55
56 return 0;
57 }
58
59 int S3MultiPartInitiationParser::parserEndElemCb(int state, const char *nspace, const char *name){
60 (void) state;
61 (void) nspace;
62 (void) name;
63 return 0;
64 }
65
66 std::deque<FileProperties> & S3MultiPartInitiationParser::getProperties(){
67 return unusedFileProps;
68 }
69
70 std::string S3MultiPartInitiationParser::getUploadId() const {
71 return uploadId;
72 }
73
74 }