summaryrefslogtreecommitdiff
path: root/src/XmlRpcRequestParserController.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-07-11 21:09:51 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-07-11 21:09:51 +0900
commit7c06b903f3493db95fcf4bd42cccc59e3b4d0692 (patch)
treef10a85795bb086e0b257a0e6c6c5ffb05f28f344 /src/XmlRpcRequestParserController.cc
parent7a57ecc5f814dc305e5e4b9bd960d69b43870c0e (diff)
Use std::unique_ptr for ValueBase object hierarchy
Diffstat (limited to 'src/XmlRpcRequestParserController.cc')
-rw-r--r--src/XmlRpcRequestParserController.cc35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/XmlRpcRequestParserController.cc b/src/XmlRpcRequestParserController.cc
index 3401a4cd..067df858 100644
--- a/src/XmlRpcRequestParserController.cc
+++ b/src/XmlRpcRequestParserController.cc
@@ -42,7 +42,7 @@ namespace rpc {
void XmlRpcRequestParserController::pushFrame()
{
- frameStack_.push(currentFrame_);
+ frameStack_.push(std::move(currentFrame_));
currentFrame_ = StateFrame();
}
@@ -50,48 +50,54 @@ void XmlRpcRequestParserController::popStructFrame()
{
assert(!frameStack_.empty());
- StateFrame parentFrame = frameStack_.top();
+ StateFrame parentFrame = std::move(frameStack_.top());
Dict* dict = downcast<Dict>(parentFrame.value_);
assert(dict);
frameStack_.pop();
if(currentFrame_.validMember()) {
- dict->put(currentFrame_.name_, currentFrame_.value_);
+ dict->put(std::move(currentFrame_.name_), std::move(currentFrame_.value_));
}
- currentFrame_ = parentFrame;
+ currentFrame_ = std::move(parentFrame);
}
void XmlRpcRequestParserController::popArrayFrame()
{
assert(!frameStack_.empty());
- StateFrame parentFrame = frameStack_.top();
+ StateFrame parentFrame = std::move(frameStack_.top());
List* list = downcast<List>(parentFrame.value_);
assert(list);
frameStack_.pop();
if(currentFrame_.value_) {
- list->append(currentFrame_.value_);
+ list->append(std::move(currentFrame_.value_));
}
- currentFrame_ = parentFrame;
+ currentFrame_ = std::move(parentFrame);
}
void XmlRpcRequestParserController::setCurrentFrameValue
-(const std::shared_ptr<ValueBase>& value)
+(std::unique_ptr<ValueBase> value)
{
- currentFrame_.value_ = value;
+ currentFrame_.value_ = std::move(value);
}
void XmlRpcRequestParserController::setCurrentFrameName
-(const std::string& name)
+(std::string name)
{
- currentFrame_.name_ = name;
+ currentFrame_.name_ = std::move(name);
}
-const std::shared_ptr<ValueBase>&
+const std::unique_ptr<ValueBase>&
XmlRpcRequestParserController::getCurrentFrameValue() const
{
return currentFrame_.value_;
}
+std::unique_ptr<ValueBase>
+XmlRpcRequestParserController::popCurrentFrameValue()
+{
+ return std::move(currentFrame_.value_);
+}
+
void XmlRpcRequestParserController::reset()
{
while(!frameStack_.empty()) {
@@ -101,6 +107,11 @@ void XmlRpcRequestParserController::reset()
methodName_.clear();
}
+void XmlRpcRequestParserController::setMethodName(std::string methodName)
+{
+ methodName_ = std::move(methodName);
+}
+
} // namespace rpc
} // namespace aria2