<commit_before>/* <src/FlowValue.h>
 *
 * This file is part of the x0 web server project and is released under GPL-3.
 * http://www.xzero.io/
 *
 * (c) 2009-2012 <NAME> <<EMAIL>>
 */

#ifndef x0_flow_value_h
#define x0_flow_value_h

#include <x0/Api.h>
#include <x0/Defines.h>
#include <x0/IPAddress.h>

#include <string>
#include <cstring>
#include <cassert>

namespace x0 {

class RegExp;
class FlowArray;
class SocketSpec;

struct X0_PACKED X0_API FlowValue
{
	typedef bool (*Function)(void *);

	enum Type {
		VOID     = 0, // nothing
		BOOLEAN  = 1, // a boolean value
		NUMBER   = 2, // an integer value
		REGEXP   = 3, // RegExp instance, a precompiled regular expression
		STRING   = 4, // zero-terminated C-string
		BUFFER   = 5, // a string buffer with its length stored in the number_ field
		ARRAY    = 6, // FlowArray instance, an array of Flow values
		IP       = 7, // IPAddress instance, (IPv4 or IPv6 address)
		FUNCTION = 8  // function pointer to a user-specified handler
	};

	static const int TypeOffset = 0;
	static const int NumberOffset = 1;<commit_msg>[flow] FlowValue: refs #51<commit_after>/* <src/FlowValue.h>
 *
 * This file is part of the x0 web server project and is released under GPL-3.
 * http://www.xzero.io/
 *
 * (c) 2009-2012 <NAME> <<EMAIL>>
 */

#ifndef x0_flow_value_h
#define x0_flow_value_h

#include <x0/Api.h>
#include <x0/Defines.h>
#include <x0/IPAddress.h>

#include <string>
#include <cstring>
#include <cassert>

namespace x0 {

class RegExp;
class FlowArray;
class SocketSpec;

class X0_PACKED X0_API FlowValue
{
public:
	typedef bool (*Function)(void *);

	enum Type {
		VOID     = 0, // nothing
		BOOLEAN  = 1, // a boolean value
		NUMBER   = 2, // an integer value
		REGEXP   = 3, // RegExp instance, a precompiled regular expression
		STRING   = 4, // zero-terminated C-string
		BUFFER   = 5, // a string buffer with its length stored in the number_ field
		ARRAY    = 6, // FlowArray instance, an array of Flow values
		IP       = 7, // IPAddress instance, (IPv4 or IPv6 address)
		FUNCTION = 8  // function pointer to a user-specified handler
	};

	static const int TypeOffset = 0;
	static const int NumberOffset = 1;
{'fraction_non_alphanumeric': 0.11361545538178473, 'fraction_numerical': 0.029438822447102116, 'mean_word_length': 3.1907514450867054, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5187621', 'n_tokens_mistral': 818, 'n_tokens_neox': 744, 'n_words': 259}