mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
Remove 'using namespace std' from SerialTypes.h
This unfortunately cuases a ton of flow-down changes because a lot of other code was depending on that definition existing. This has a fairly large chance to break builds of external plugins, considering how many internal ones it broke.
This commit is contained in:
parent
a525f9532e
commit
d53c1454c0
119 changed files with 402 additions and 383 deletions
|
@ -22,7 +22,7 @@ Formatter::~Formatter()
|
|||
{
|
||||
}
|
||||
|
||||
string Formatter::Render(const threading::Value::addr_t& addr)
|
||||
std::string Formatter::Render(const threading::Value::addr_t& addr)
|
||||
{
|
||||
if ( addr.family == IPv4 )
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ string Formatter::Render(const threading::Value::addr_t& addr)
|
|||
}
|
||||
}
|
||||
|
||||
TransportProto Formatter::ParseProto(const string &proto) const
|
||||
TransportProto Formatter::ParseProto(const std::string &proto) const
|
||||
{
|
||||
if ( proto == "unknown" )
|
||||
return TRANSPORT_UNKNOWN;
|
||||
|
@ -62,7 +62,7 @@ TransportProto Formatter::ParseProto(const string &proto) const
|
|||
|
||||
|
||||
// More or less verbose copy from IPAddr.cc -- which uses reporter.
|
||||
threading::Value::addr_t Formatter::ParseAddr(const string &s) const
|
||||
threading::Value::addr_t Formatter::ParseAddr(const std::string &s) const
|
||||
{
|
||||
threading::Value::addr_t val;
|
||||
|
||||
|
@ -90,7 +90,7 @@ threading::Value::addr_t Formatter::ParseAddr(const string &s) const
|
|||
return val;
|
||||
}
|
||||
|
||||
string Formatter::Render(const threading::Value::subnet_t& subnet)
|
||||
std::string Formatter::Render(const threading::Value::subnet_t& subnet)
|
||||
{
|
||||
char l[16];
|
||||
|
||||
|
@ -99,19 +99,19 @@ string Formatter::Render(const threading::Value::subnet_t& subnet)
|
|||
else
|
||||
modp_uitoa10(subnet.length, l);
|
||||
|
||||
string s = Render(subnet.prefix) + "/" + l;
|
||||
std::string s = Render(subnet.prefix) + "/" + l;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
string Formatter::Render(double d)
|
||||
std::string Formatter::Render(double d)
|
||||
{
|
||||
char buf[256];
|
||||
modp_dtoa(d, buf, 6);
|
||||
return buf;
|
||||
}
|
||||
|
||||
string Formatter::Render(TransportProto proto)
|
||||
std::string Formatter::Render(TransportProto proto)
|
||||
{
|
||||
if ( proto == TRANSPORT_UDP )
|
||||
return "udp";
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
*/
|
||||
bool Terminating() const { return terminating; }
|
||||
|
||||
typedef std::list<std::pair<string, MsgThread::Stats> > msg_stats_list;
|
||||
typedef std::list<std::pair<std::string, MsgThread::Stats> > msg_stats_list;
|
||||
|
||||
/**
|
||||
* Returns statistics from all current MsgThread instances.
|
||||
|
|
|
@ -382,7 +382,7 @@ BasicInputMessage* MsgThread::RetrieveIn()
|
|||
return 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
string s = Fmt("Retrieved '%s' in %s", msg->Name(), Name());
|
||||
std::string s = Fmt("Retrieved '%s' in %s", msg->Name(), Name());
|
||||
Debug(DBG_THREADING, s.c_str());
|
||||
#endif
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ bool Field::Read(SerializationFormat* fmt)
|
|||
{
|
||||
int t;
|
||||
int st;
|
||||
string tmp_name;
|
||||
std::string tmp_name;
|
||||
bool have_2nd;
|
||||
|
||||
if ( ! fmt->Read(&have_2nd, "have_2nd") )
|
||||
|
@ -19,7 +19,7 @@ bool Field::Read(SerializationFormat* fmt)
|
|||
|
||||
if ( have_2nd )
|
||||
{
|
||||
string tmp_secondary_name;
|
||||
std::string tmp_secondary_name;
|
||||
if ( ! fmt->Read(&tmp_secondary_name, "secondary_name") )
|
||||
return false;
|
||||
|
||||
|
@ -64,9 +64,9 @@ bool Field::Write(SerializationFormat* fmt) const
|
|||
fmt->Write(optional, "optional"));
|
||||
}
|
||||
|
||||
string Field::TypeName() const
|
||||
std::string Field::TypeName() const
|
||||
{
|
||||
string n;
|
||||
std::string n;
|
||||
|
||||
// We do not support tables, if the internal Bro type is table it
|
||||
// always is a set.
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#include "Type.h"
|
||||
#include "net_util.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class SerializationFormat;
|
||||
|
||||
namespace threading {
|
||||
|
@ -73,7 +71,7 @@ struct Field {
|
|||
* Returns a textual description of the field's type. This method is
|
||||
* thread-safe.
|
||||
*/
|
||||
string TypeName() const;
|
||||
std::string TypeName() const;
|
||||
|
||||
private:
|
||||
// Force usage of constructor above.
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <sstream>
|
||||
#include <errno.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace threading::formatter;
|
||||
|
||||
// If the value we'd write out would match exactly the a reserved string, we
|
||||
|
|
|
@ -14,16 +14,17 @@ public:
|
|||
*/
|
||||
struct SeparatorInfo
|
||||
{
|
||||
string separator; // Separator between columns
|
||||
string set_separator; // Separator between set elements.
|
||||
string unset_field; // String marking an unset field.
|
||||
string empty_field; // String marking an empty (but set) field.
|
||||
std::string separator; // Separator between columns
|
||||
std::string set_separator; // Separator between set elements.
|
||||
std::string unset_field; // String marking an unset field.
|
||||
std::string empty_field; // String marking an empty (but set) field.
|
||||
|
||||
/**
|
||||
* Constructor that defines all the configuration options.
|
||||
* Use if you need either ValToODesc or EntryToVal.
|
||||
*/
|
||||
SeparatorInfo(const string& separator, const string& set_separator, const string& unset_field, const string& empty_field);
|
||||
SeparatorInfo(const std::string& separator, const std::string& set_separator,
|
||||
const std::string& unset_field, const std::string& empty_field);
|
||||
|
||||
/**
|
||||
* Constructor that leaves separators etc unset to dummy
|
||||
|
@ -46,10 +47,11 @@ public:
|
|||
Ascii(threading::MsgThread* t, const SeparatorInfo& info);
|
||||
virtual ~Ascii();
|
||||
|
||||
virtual bool Describe(ODesc* desc, threading::Value* val, const string& name = "") const;
|
||||
virtual bool Describe(ODesc* desc, threading::Value* val, const std::string& name = "") const;
|
||||
virtual bool Describe(ODesc* desc, int num_fields, const threading::Field* const * fields,
|
||||
threading::Value** vals) const;
|
||||
virtual threading::Value* ParseValue(const string& s, const string& name, TypeTag type, TypeTag subtype = TYPE_ERROR) const;
|
||||
virtual threading::Value* ParseValue(const std::string& s, const std::string& name,
|
||||
TypeTag type, TypeTag subtype = TYPE_ERROR) const;
|
||||
|
||||
private:
|
||||
bool CheckNumberError(const char* start, const char* end) const;
|
||||
|
|
|
@ -55,7 +55,7 @@ bool JSON::Describe(ODesc* desc, int num_fields, const Field* const * fields,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool JSON::Describe(ODesc* desc, Value* val, const string& name) const
|
||||
bool JSON::Describe(ODesc* desc, Value* val, const std::string& name) const
|
||||
{
|
||||
if ( desc->IsBinary() )
|
||||
{
|
||||
|
@ -78,13 +78,13 @@ bool JSON::Describe(ODesc* desc, Value* val, const string& name) const
|
|||
return true;
|
||||
}
|
||||
|
||||
threading::Value* JSON::ParseValue(const string& s, const string& name, TypeTag type, TypeTag subtype) const
|
||||
threading::Value* JSON::ParseValue(const std::string& s, const std::string& name, TypeTag type, TypeTag subtype) const
|
||||
{
|
||||
GetThread()->Error("JSON formatter does not support parsing yet.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void JSON::BuildJSON(NullDoubleWriter& writer, Value* val, const string& name) const
|
||||
void JSON::BuildJSON(NullDoubleWriter& writer, Value* val, const std::string& name) const
|
||||
{
|
||||
if ( ! val->present )
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ void JSON::BuildJSON(NullDoubleWriter& writer, Value* val, const string& name) c
|
|||
case TYPE_FILE:
|
||||
case TYPE_FUNC:
|
||||
{
|
||||
writer.String(json_escape_utf8(string(val->val.string_val.data, val->val.string_val.length)));
|
||||
writer.String(json_escape_utf8(std::string(val->val.string_val.data, val->val.string_val.length)));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@ public:
|
|||
JSON(threading::MsgThread* t, TimeFormat tf);
|
||||
~JSON() override;
|
||||
|
||||
bool Describe(ODesc* desc, threading::Value* val, const string& name = "") const override;
|
||||
bool Describe(ODesc* desc, threading::Value* val, const std::string& name = "") const override;
|
||||
bool Describe(ODesc* desc, int num_fields, const threading::Field* const * fields,
|
||||
threading::Value** vals) const override;
|
||||
threading::Value* ParseValue(const string& s, const string& name, TypeTag type, TypeTag subtype = TYPE_ERROR) const override;
|
||||
threading::Value* ParseValue(const std::string& s, const std::string& name, TypeTag type, TypeTag subtype = TYPE_ERROR) const override;
|
||||
|
||||
class NullDoubleWriter : public rapidjson::Writer<rapidjson::StringBuffer> {
|
||||
public:
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
void BuildJSON(NullDoubleWriter& writer, Value* val, const string& name = "") const;
|
||||
void BuildJSON(NullDoubleWriter& writer, Value* val, const std::string& name = "") const;
|
||||
|
||||
TimeFormat timestamps;
|
||||
bool surrounding_braces;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue