mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Reformat the world
This commit is contained in:
parent
194cb24547
commit
b2f171ec69
714 changed files with 35149 additions and 35203 deletions
36
src/File.h
36
src/File.h
|
@ -3,7 +3,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -15,16 +14,18 @@
|
|||
#include "zeek/Val.h"
|
||||
#include "zeek/util.h"
|
||||
|
||||
namespace zeek {
|
||||
namespace zeek
|
||||
{
|
||||
|
||||
namespace detail {
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class PrintStmt;
|
||||
class Attributes;
|
||||
|
||||
extern void do_print_stmt(const std::vector<ValPtr>& vals);
|
||||
|
||||
} // namespace detail;
|
||||
} // namespace detail;
|
||||
|
||||
class RecordVal;
|
||||
class Type;
|
||||
|
@ -33,7 +34,8 @@ using TypePtr = IntrusivePtr<Type>;
|
|||
class File;
|
||||
using FilePtr = IntrusivePtr<File>;
|
||||
|
||||
class File final : public Obj {
|
||||
class File final : public Obj
|
||||
{
|
||||
public:
|
||||
explicit File(FILE* arg_f);
|
||||
File(FILE* arg_f, const char* filename, const char* access);
|
||||
|
@ -45,19 +47,18 @@ public:
|
|||
// Returns false if an error occured.
|
||||
bool Write(const char* data, int len = 0);
|
||||
|
||||
void Flush() { fflush(f); }
|
||||
void Flush() { fflush(f); }
|
||||
|
||||
FILE* Seek(long position); // seek to absolute position
|
||||
FILE* Seek(long position); // seek to absolute position
|
||||
|
||||
void SetBuf(bool buffered); // false=line buffered, true=fully buffered
|
||||
void SetBuf(bool buffered); // false=line buffered, true=fully buffered
|
||||
|
||||
const TypePtr& GetType() const
|
||||
{ return t; }
|
||||
const TypePtr& GetType() const { return t; }
|
||||
|
||||
// Whether the file is open in a general sense; it might
|
||||
// not be open as a Unix file due to our management of
|
||||
// a finite number of FDs.
|
||||
bool IsOpen() const { return is_open; }
|
||||
bool IsOpen() const { return is_open; }
|
||||
|
||||
// Returns true if the close made sense, false if it was already
|
||||
// closed, not active, or whatever.
|
||||
|
@ -80,14 +81,13 @@ public:
|
|||
// Get the file with the given name, opening it if it doesn't yet exist.
|
||||
static FilePtr Get(const char* name);
|
||||
|
||||
void EnableRawOutput() { raw_output = true; }
|
||||
bool IsRawOutput() const { return raw_output; }
|
||||
void EnableRawOutput() { raw_output = true; }
|
||||
bool IsRawOutput() const { return raw_output; }
|
||||
|
||||
protected:
|
||||
|
||||
friend void detail::do_print_stmt(const std::vector<ValPtr>& vals);
|
||||
|
||||
File() { Init(); }
|
||||
File() { Init(); }
|
||||
void Init();
|
||||
|
||||
/**
|
||||
|
@ -114,7 +114,7 @@ protected:
|
|||
char* access;
|
||||
detail::Attributes* attrs;
|
||||
double open_time;
|
||||
bool is_open; // whether the file is open in a general sense
|
||||
bool is_open; // whether the file is open in a general sense
|
||||
bool buffered;
|
||||
bool raw_output;
|
||||
|
||||
|
@ -122,6 +122,6 @@ protected:
|
|||
|
||||
private:
|
||||
static std::list<std::pair<std::string, File*>> open_files;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace zeek
|
||||
} // namespace zeek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue