mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
// See the file "COPYING" in the main distribution directory for copyright.
|
|
|
|
#ifndef FILE_ANALYSIS_FILEID_H
|
|
#define FILE_ANALYSIS_FILEID_H
|
|
|
|
namespace file_analysis {
|
|
|
|
/**
|
|
* A simple string wrapper class to help enforce some type safety between
|
|
* methods of FileAnalysis::Manager, some of which use a unique string to
|
|
* identify files, and others which use a pretty hash (the FileID) to identify
|
|
* files. A FileID is primarily used in methods which interface with the
|
|
* script-layer, while the unique strings are used for methods which interface
|
|
* with protocol analyzers or anything that sends data to the file analysis
|
|
* framework.
|
|
*/
|
|
struct FileID {
|
|
string id;
|
|
|
|
explicit FileID(const string arg_id) : id(arg_id) {}
|
|
FileID(const FileID& other) : id(other.id) {}
|
|
|
|
const char* c_str() const { return id.c_str(); }
|
|
|
|
bool operator==(const FileID& rhs) const { return id == rhs.id; }
|
|
bool operator<(const FileID& rhs) const { return id < rhs.id; }
|
|
|
|
FileID& operator=(const FileID& rhs) { id = rhs.id; return *this; }
|
|
FileID& operator=(const string& rhs) { id = rhs; return *this; }
|
|
};
|
|
|
|
} // namespace file_analysis
|
|
|
|
#endif
|