1 /*
2  * Copyright 2009-2017 Alibaba Cloud All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 #include <alibabacloud/oss/Export.h>
19 #include <alibabacloud/oss/Types.h>
20 namespace AlibabaCloud
21 {
22 namespace OSS
23 {
24     class ALIBABACLOUD_OSS_EXPORT Tag
25     {
26     public:
Tag()27         Tag() {};
Tag(const std::string & key,const std::string & value)28         Tag(const std::string& key, const std::string& value) :
29             key_(key), value_(value)
30         {}
setKey(const std::string & key)31         void setKey(const std::string& key) { key_ = key; }
setValue(const std::string & value)32         void setValue(const std::string& value) { value_ = value; }
Key()33         const std::string& Key() const { return key_; }
Value()34         const std::string& Value() const { return value_; }
35     private:
36         std::string key_;
37         std::string value_;
38     };
39 
40     using TagSet = std::vector<Tag>;
41 
42     class ALIBABACLOUD_OSS_EXPORT Tagging
43     {
44     public:
Tagging()45         Tagging() {};
Tagging(const TagSet & tags)46         Tagging(const TagSet& tags) { tagSet_ = tags;}
47 
Tags()48         const TagSet& Tags() const { return tagSet_; }
setTags(const TagSet & tags)49         void setTags(const TagSet& tags) { tagSet_ = tags; }
setTags(TagSet && tags)50         void setTags(TagSet&& tags) { tagSet_ = std::move(tags); }
addTag(const Tag & tag)51         void addTag(const Tag& tag)  { tagSet_.push_back(tag) ; }
addTag(Tag && tag)52         void addTag(Tag&& tag) { tagSet_.push_back(std::move(tag)); }
clear()53         void clear() { tagSet_.clear();}
54         std::string toQueryParameters();
55     private:
56         TagSet tagSet_;
57     };
58 }
59 }
60