summaryrefslogtreecommitdiff
path: root/src/rgw/rgw_multi_del.cc
blob: 612a4fb6f947ea04a37949a046911f151e05a152 (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
#include "include/types.h"

#include <string.h>
#include <iostream>

#include "rgw_multi_del.h"

using namespace std;

#define dout_subsys ceph_subsys_rgw


bool RGWMultiDelObject::xml_end(const char *el)
{
  RGWMultiDelKey *key_obj = (RGWMultiDelKey *)find_first("Key");

  if (!key_obj)
    return false;

  string s = key_obj->get_data();
  if (s.empty())
    return false;

  key = s;

  return true;
}

bool RGWMultiDelDelete::xml_end(const char *el) {
  RGWMultiDelQuiet *quiet_set = (RGWMultiDelQuiet *)find_first("Quiet");
  if (quiet_set) {
    string quiet_val = quiet_set->get_data();
    quiet = (strcasecmp(quiet_val.c_str(), "true") == 0);
  }

  XMLObjIter iter = find("Object");
  RGWMultiDelObject *object = (RGWMultiDelObject *)iter.get_next();
  while (object) {
    string key = object->get_key();
    objects.push_back(key);
    object = (RGWMultiDelObject *)iter.get_next();
  }
  return true;
}

XMLObj *RGWMultiDelXMLParser::alloc_obj(const char *el) {
  XMLObj *obj = NULL;
  if (strcmp(el, "Delete") == 0) {
    obj = new RGWMultiDelDelete();
  } else if (strcmp(el, "Quiet") == 0) {
    obj = new RGWMultiDelQuiet();
  } else if (strcmp(el, "Object") == 0) {
    obj = new RGWMultiDelObject ();
  } else if (strcmp(el, "Key") == 0) {
    obj = new RGWMultiDelKey();
  } else if (strcmp(el, "VersionID") == 0) {
    /*do nothing*/
  }

  return obj;
}