Commit 319d3b01 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #7258: Cleanup in historyitem

parent f08e3518
......@@ -30,14 +30,20 @@
* as that of the covered work.
*/
#include <historyitem.h>
#include "historyitem.h"
#include <sstream>
#include "stdlib.h"
#include <manager.h>
#define ITEM_SEPARATOR "|"
HistoryItem::HistoryItem(std::string timestamp_start, CallType call_type, std::string timestamp_stop, std::string name, std::string number, std::string id, std::string account_id, std::string recording, std::string confID, std::string timeAdded)
#include <cstdlib>
#include "manager.h"
static const char * const ITEM_SEPARATOR = "|";
HistoryItem::HistoryItem(const std::string &timestamp_start,
CallType call_type, const std::string &timestamp_stop,
const std::string &name, const std::string &number,
const std::string &id, const std::string &account_id,
const std::string &recording,
const std::string &confID,
const std::string &timeAdded)
: timestamp_start_(timestamp_start),
timestamp_stop_(timestamp_stop),
call_type_(call_type),
......@@ -53,11 +59,9 @@ HistoryItem::HistoryItem(std::string timestamp_start, CallType call_type, std::s
HistoryItem::HistoryItem(std::string serialized_form)
{
int index = 0;
while (serialized_form.find(ITEM_SEPARATOR, 0) != std::string::npos) {
for (int index = 0; serialized_form.find(ITEM_SEPARATOR, 0) != std::string::npos; ++index) {
size_t pos = serialized_form.find(ITEM_SEPARATOR, 0);
std::string tmp = serialized_form.substr(0, pos);
std::string tmp(serialized_form.substr(0, pos));
serialized_form.erase(0, pos + 1);
switch (index) {
......@@ -98,8 +102,6 @@ HistoryItem::HistoryItem(std::string serialized_form)
ERROR("Unserialized form %d not recognized\n", index);
break;
}
++index;
}
}
......
......@@ -59,7 +59,10 @@ class HistoryItem {
* @param Configuration ID
* @param time added
*/
HistoryItem(std::string, CallType, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string);
HistoryItem(const std::string&, CallType, const std::string&,
const std::string&, const std::string&, const std::string&,
const std::string&, const std::string&, const std::string&,
const std::string&);
/*
* Constructor from a serialized form
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment