text:
#ifndef CPL_STRING_H_INCLUDED
#define CPL_STRING_H_INCLUDED

#include "cpl_error.h"
#include "cpl_conv.h"
#include "cpl_vsi.h"

/**
 * \file cpl_string.h
 *
 * Various convenience functions for working with strings and string lists.
 *
 * A StringList is just an array of strings with the last pointer being
 * NULL.  An empty StringList may be either a NULL pointer, or a pointer to
 * a pointer memory location with a NULL value.
 *
 * A common convention for StringLists is to use them to store name/value
 * lists.  In this case the contents are treated like a dictionary of
 * name/value pairs.  The actual data is formatted with each string having
 * the format "<name>:<value>" (though "=" is also an acceptable separator).
 * A number of the functions in the file operate on name/value style
 * string lists (such as CSLSetNameValue(), and CSLFetchNameValue()).
 *
 * To some extent the CPLStringList C++ class can be used to abstract
 * managing string lists a bit but still be able to return them from C
 * functions.
 *
 */

CPL_C_START

char CPL_DLL **CSLAddString(char **papszStrList,
                            const char *pszNewString) CPL_WARN_UNUSED_RESULT;
char CPL_DLL **CSLAddStringMayFail(
    char **papszStrList, const char *pszNewString) CPL_WARN_UNUSED_RESULT;
#ifdef __cplusplus
  int CPL_DLL CSLCount(const char * const *papszStrList);
#else
  int CPL_DLL CSLCount(char **papszStrList);
#endif
const char CPL_DLL *CSLGetField( char **, int );
void CPL_DLL CPL_STDCALL CSLDestroy(char **papszStrList);
char CPL_DLL **CSLDuplicate(char **papszStrList) CPL_WARN_UNUSED_RESULT;
char CPL_DLL **CSLMerge( char **papszOrig,
                         char **papszOverride ) CPL_WARN_UNUSED_RESULT;

char CPL_DLL **CSLTokenizeString(const char *pszString ) CPL_WARN_UNUSED_RESULT;
char CPL_DLL **CSLTokenizeStringComplex(
    const char *pszString, const char *pszDelimiter, int bHonourStrings,
    int bAllowEmptyTokens ) CPL_WARN_UNUSED_RESULT;
char CPL_DLL **CSLTokenizeString2( const char *pszString,
                                   const char *pszDelimiter,
                                   int nCSLTFlags ) CPL_WARN_UNUSED_RESULT;

#define CSLT_HONOURSTRINGS      0x0001
#define CSLT_ALLOWEMPTYTOKENS   0x0002
#define CSLT_PRESERVEQUOTES     0x0004
#define CSLT_PRESERVEESCAPES    0x0008
#define CSLT_STRIPLEADSPACES    0x0010
#define CSLT_STRIPENDSPACES     0x0020

int CPL_DLL CSLPrint(char **papszStrList, FILE *fpOut);
char CPL_DLL **CSLLoad(const char *pszFname) CPL_WARN_UNUSED_RESULT;
char CPL_DLL **CSLLoad2(const char *pszFname, int nMaxLines, int nMaxCols,
                        char** papszOptions) CPL_WARN_UNUSED_RESULT;
int CPL_DLL CSLSave(char **papszStrList, const char *pszFname);

char CPL_DLL **CSLInsertStrings(char **papszStrList, int nInsertAtLineNo,
                         char **papszNewLines) CPL_WARN_UNUSED_RESULT;
char CPL_DLL **CSLInsertString(char **papszStrList, int nInsertAtLineNo,
                               const char *pszNewLine) CPL_WARN_UNUSED_RESULT;
char CPL_DLL **CSLRemoveStrings(
    char **papszStrList, int nFirstLineToDelete,
    int nNumToRemove, char ***ppapszRetStrings) CPL_WARN_UNUSED_RESULT;
int CPL_DLL CSLFindString( char **, const char * );
int CPL_DLL CSLFindStringCaseSensitive( char **, const char * );
int CPL_DLL CSLPartialFindString( char **papszHaystack,
                                  const char * pszNeedle );
int CPL_DLL CSLFindName(char **papszStrList, const char *pszName);
int CPL_DLL CSLFetchBoolean( char **papszStrList, const char *pszKey,
                             int bDefault );

/* TODO: Deprecate CSLTestBoolean.  Remove in GDAL 3.x. */
int CPL_DLL CSLTestBoolean( const char *pszValue );
int CPL_DLL CPLTestBoolean( const char *pszValue );

#ifdef __cplusplus
#ifdef DO_NOT_USE_DEBUG_BOOL
#define CPLTestBool(x) CPL_TO_BOOL(CPLTestBoolean(x))
#else
/* Prefer these for C++ code. */
#ifdef DEBUG_BOOL
extern "C++" {
#endif
bool CPL_DLL CPLTestBool( const char *pszValue );
#ifdef DEBUG_BOOL
}
#endif
#endif
bool CPL_DLL CPLFetchBool( const char **papszStrList, const char *pszKey,
                           bool bDefault );
#endif  /* __cplusplus */

const char CPL_DLL *
      CPLParseNameValue(const char *pszNameValue, char **ppszKey );
const char CPL_DLL *
      CSLFetchNameValue(char **papszStrList, const char *pszName);
const char CPL_DLL *
      CSLFetchNameValueDef(char **papszStrList, const char *pszName,
                           const char *pszDefault );
char CPL_DLL **
      CSLFetchNameValueMultiple(char **papszStrList, const char *pszName);
char CPL_DLL **
      CSLAddNameValue(char **papszStrList,
                      const char *pszName,
                      const char *pszValue) CPL_WARN_UNUSED_RESULT;
char CPL_DLL **
      CSLSetNameValue(char **papszStrList,
                      const char *pszName,
                      const char *pszValue) CPL_WARN_UNUSED_RESULT;
void CPL_DLL CSLSetNameValueSeparator( char ** papszStrList,
                                       const char *pszSeparator );

char CPL_DLL ** CSLParseCommandLine(const char* pszCommandLine);

#define CPLES_BackslashQuotable 0
#define CPLES_XML               1
#define CPLES_URL               2
#define CPLES_SQL               3
#define CPLES_CSV               4
#define CPLES_XML_BUT_QUOTES    5

char CPL_DLL *CPLEscapeString( const char *pszString, int nLength,
                               int nScheme ) CPL_WARN_UNUSED_RESULT;
char CPL_DLL *CPLUnescapeString( const char *pszString, int *pnLength,
                                 int nScheme ) CPL_WARN_UNUSED_RESULT;

char CPL_DLL *CPLBinaryToHex( int nBytes,
                              const GByte *pabyData ) CPL_WARN_UNUSED_RESULT;
GByte CPL_DLL *CPLHexToBinary( const char *pszHex,
                               int *pnBytes ) CPL_WARN_UNUSED_RESULT;

char CPL_DLL *CPLBase64Encode( int nBytes,
                               const GByte *pabyData ) CPL_WARN_UNUSED_RESULT;
int CPL_DLL CPLBase64DecodeInPlace( GByte* pszBase64 );

typedef enum
{
    CPL_VALUE_STRING,
    CPL_VALUE_REAL,
    CPL_VALUE_INTEGER
} CPLValueType;

CPLValueType CPL_DLL CPLGetValueType(const char* pszValue);

size_t CPL_DLL CPLStrlcpy(char* pszDest, const char* pszSrc, size_t nDestSize);
size_t CPL_DLL CPLStrlcat(char* pszDest, const char* pszSrc, size_t nDestSize);
size_t CPL_DLL CPLStrnlen(const char *pszStr, size_t nMaxLen);

/* -------------------------------------------------------------------- */
/*      Locale independent formatting functions.                        */
/* -------------------------------------------------------------------- */
int CPL_DLL CPLvsnprintf(char *str, size_t size, const char* fmt,
                         va_list args) CPL_PRINT_FUNC_FORMAT (3, 0);
int CPL_DLL CPLsnprintf(char *str, size_t size,
                        const char* fmt, ...) CPL_PRINT_FUNC_FORMAT(3,4);
#if defined(GDAL_COMPILATION) && !defined(DONT_DEPRECATE_SPRINTF)
int CPL_DLL CPLsprintf(char *str, const char* fmt, ...)
    CPL_PRINT_FUNC_FORMAT(2, 3) CPL_WARN_DEPRECATED("Use CPLsnprintf instead");
#else
int CPL_DLL CPLsprintf(char *str, const char* fmt, ...)
    CPL_PRINT_FUNC_FORMAT(2, 3);
#endif
int CPL_DLL CPLprintf(const char* fmt, ...) CPL_PRINT_FUNC_FORMAT(1, 2);
/* caution: only works with limited number of formats */
int CPL_DLL CPLsscanf(const char* str, const char* fmt, ...)
    CPL_SCAN_FUNC_FORMAT(2, 3);

const char CPL_DLL *CPLSPrintf(const char *fmt, ...)
    CPL_PRINT_FUNC_FORMAT(1, 2) CPL_WARN_UNUSED_RESULT;
char CPL_DLL **CSLAppendPrintf(char **papszStrList, const char *fmt, ...)
    CPL_PRINT_FUNC_FORMAT(2, 3) CPL_WARN_UNUSED_RESULT;
int CPL_DLL CPLVASPrintf(char **buf, const char *fmt, va_list args )
    CPL_PRINT_FUNC_FORMAT(2, 0);

/* -------------------------------------------------------------------- */
/*      RFC 23 character set conversion/recoding API (cpl_recode.cpp).  */
/* -------------------------------------------------------------------- */
#define CPL_ENC_LOCALE     ""
#define CPL_ENC_UTF8       "UTF-8"
#define CPL_ENC_UTF16      "UTF-16"
#define CPL_ENC_UCS2       "UCS-2"
#define CPL_ENC_UCS4       "UCS-4"
#define CPL_ENC_ASCII      "ASCII"
#define CPL_ENC_ISO8859_1  "ISO-8859-1"

int CPL_DLL  CPLEncodingCharSize( const char *pszEncoding );
void CPL_DLL  CPLClearRecodeWarningFlags( void );
char CPL_DLL *CPLRecode(
    const char *pszSource, const char *pszSrcEncoding,
    const char *pszDstEncoding ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
char CPL_DLL *CPLRecodeFromWChar(
    const wchar_t *pwszSource, const char *pszSrcEncoding,
    const char *pszDstEncoding ) CPL_WARN_UNUSED_RESULT;
wchar_t CPL_DLL *CPLRecodeToWChar(
    const char *pszSource, const char *pszSrcEncoding,
    const char *pszDstEncoding ) CPL_WARN_UNUSED_RESULT;
int CPL_DLL CPLIsUTF8(const char* pabyData, int nLen);
char CPL_DLL *CPLForceToASCII(
    const char* pabyData, int nLen,
    char chReplacementChar) CPL_WARN_UNUSED_RESULT;
int CPL_DLL CPLStrlenUTF8(const char *pszUTF8Str);

CPL_C_END

/************************************************************************/
/*                              CPLString                               */
/************************************************************************/

#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)

#include <string>

/*
 * Simple trick to avoid "using" declaration in header for new compilers
 * but make it still working with old compilers which throw C2614 errors.
 *
 * Define MSVC_OLD_STUPID_BEHAVIOUR
 * for old compilers: VC++ 5 and 6 as well as eVC++ 3 and 4.
 */

/*
 * Detect old MSVC++ compiler <= 6.0
 * 1200 - VC++ 6.0
 * 1200-1202 - eVC++ 4.0
 */
#if defined(_MSC_VER)
# if (_MSC_VER <= 1202)
#  define MSVC_OLD_STUPID_BEHAVIOUR
# endif
#endif

/* Avoid C2614 errors */
#ifdef MSVC_OLD_STUPID_BEHAVIOUR
    using std::string;
# define gdal_std_string string
#else
# define gdal_std_string std::string
#endif

//! Convenient string class based on std::string.
class CPL_DLL CPLString : public gdal_std_string
{
public:

    CPLString(void) {}
    CPLString( const std::string &oStr ) : gdal_std_string( oStr ) {}
    CPLString( const char *pszStr ) : gdal_std_string( pszStr ) {}

    operator const char* (void) const { return c_str(); }

    char& operator[](std::string::size_type i)
    {
        return gdal_std_string::operator[](i);
    }

    const char& operator[](std::string::size_type i) const
    {
        return gdal_std_string::operator[](i);
    }

    char& operator[](int i)
    {
        return gdal_std_string::operator[](
            static_cast<std::string::size_type>(i));
    }

    const char& operator[](int i) const
    {
        return gdal_std_string::operator[](
            static_cast<std::string::size_type>(i));
    }

    void Clear() { resize(0); }

    // NULL safe assign and free.
    void Seize(char *pszValue)
    {
        if (pszValue == NULL )
            Clear();
        else
        {
            *this = pszValue;
            CPLFree(pszValue);
        }
    }

    /* There seems to be a bug in the way the compiler count indices...
     * Should be CPL_PRINT_FUNC_FORMAT (1, 2) */
    CPLString &Printf(
        const char *pszFormat, ... ) CPL_PRINT_FUNC_FORMAT (2, 3);
    CPLString &vPrintf(
        const char *pszFormat, va_list args ) CPL_PRINT_FUNC_FORMAT(2, 0);
    CPLString &FormatC( double dfValue, const char *pszFormat = NULL );
    CPLString &Trim();
    CPLString &Recode( const char *pszSrcEncoding, const char *pszDstEncoding );

    /* case insensitive find alternates */
    size_t    ifind( const std::string & str, size_t pos = 0 ) const;
    size_t    ifind( const char * s, size_t pos = 0 ) const;
    CPLString &toupper( void );
    CPLString &tolower( void );
};

CPLString CPLOPrintf(const char *pszFormat, ... ) CPL_PRINT_FUNC_FORMAT (1, 2);
CPLString CPLOvPrintf(
    const char *pszFormat, va_list args) CPL_PRINT_FUNC_FORMAT (1, 0);

/* -------------------------------------------------------------------- */
/*      URL processing functions, here since they depend on CPLString.  */
/* -------------------------------------------------------------------- */
CPLString CPL_DLL CPLURLGetValue(const char* pszURL, const char* pszKey);
CPLString CPL_DLL CPLURLAddKVP(const char* pszURL, const char* pszKey,
                               const char* pszValue);

/************************************************************************/
/*                            CPLStringList                             */
/************************************************************************/

//! String list class designed around our use of C "char**" string lists.
class CPL_DLL CPLStringList
{
    char **papszList;
    mutable int nCount;
    mutable int nAllocation;
    bool   bOwnList;
    bool   bIsSorted;

    void   Initialize();
    void   MakeOurOwnCopy();
    void   EnsureAllocation( int nMaxLength );
    int    FindSortedInsertionPoint( const char *pszLine );

  public:
    CPLStringList();
    CPLStringList( char **papszList, int bTakeOwnership=TRUE );
    CPLStringList( const CPLStringList& oOther );
    ~CPLStringList();

    CPLStringList &Clear();

    int    size() const { return Count(); }
    int    Count() const;

    CPLStringList &AddString( const char *pszNewString );
    CPLStringList &AddStringDirectly( char *pszNewString );

    CPLStringList &InsertString( int nInsertAtLineNo, const char *pszNewLine )
    { return InsertStringDirectly( nInsertAtLineNo, CPLStrdup(pszNewLine) ); }
    CPLStringList &InsertStringDirectly( int nInsertAtLineNo, char *pszNewLine);

    // CPLStringList &InsertStrings( int nInsertAtLineNo, char **papszNewLines );
    // CPLStringList &RemoveStrings( int nFirstLineToDelete, int nNumToRemove=1 );

    int    FindString( const char *pszTarget ) const
    { return CSLFindString( papszList, pszTarget ); }
    int    PartialFindString( const char *pszNeedle ) const
    { return CSLPartialFindString( papszList, pszNeedle ); }

    int    FindName( const char *pszName ) const;
    bool   FetchBool( const char *pszKey, bool bDefault ) const;
    // Deprecated.
    int    FetchBoolean( const char *pszKey, int bDefault ) const;
    const char *FetchNameValue( const char *pszKey ) const;
    const char *FetchNameValueDef(
        const char *pszKey, const char *pszDefault ) const;
    CPLStringList &AddNameValue( const char *pszKey, const char *pszValue );
    CPLStringList &SetNameValue( const char *pszKey, const char *pszValue );

    CPLStringList &Assign( char **papszListIn, int bTakeOwnership=TRUE );
    CPLStringList &operator=(char **papszListIn) {
      return Assign( papszListIn, TRUE ); }
    CPLStringList &operator=(const CPLStringList& oOther);

    char * operator[](int i);
    char * operator[](size_t i) { return (*this)[static_cast<int>(i)]; }
    const char * operator[](int i) const;
    const char * operator[](size_t i) const {
      return (*this)[static_cast<int>(i)]; }

    char **List() { return papszList; }
    char **StealList();

    CPLStringList &Sort();
    int    IsSorted() const { return bIsSorted; }

    operator char**(void) { return List(); }
};

#endif /* def __cplusplus && !CPL_SUPRESS_CPLUSPLUS */

#endif /* CPL_STRING_H_INCLUDED */


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>HTTP Request — cpp-netlib v0.11.2</title>

    <link rel="stylesheet" href="../_static/pyramid.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="top" title="cpp-netlib v0.11.2" href="../index.html" />
    <link rel="up" title="Reference Manual" href="../reference.html" />
    <link rel="next" title="HTTP Response" href="http_response.html" />
    <link rel="prev" title="HTTP Client API" href="http_client.html" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&subset=latin" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&subset=latin" type="text/css" media="screen" charset="utf-8" />

Navigation

          next

          previous |

cpp-netlib v0.11.2 »

Reference Manual »

HTTP Request¶

This part of the documentation talks about the publicly accessible API of the
HTTP Request objects. This section details the Request Concepts requirements,
the implemented and required Directives, Modifiers, and Wrappers that work
with the HTTP Request objects.

Request Concepts¶

There are two generally supported Request Concepts implemented in the library.
The first of two is the Normal Client Request Concept and the second is the
Pod Server Request Concept.

The Normal Client Request Concept is what the HTTP Client interface requires.
All operations performed internally by the HTTP Client abide by the interface
required by this concept definition.

The Pod Server Request Concept is as the name suggests what the HTTP Server
implementation requires from Request Objects.

Switching on whether the Request concept chooses either of the Normal Client
Request Concept or the Pod Server Request Concept is done through the
nested <tt class="docutils literal">tag</tt> type and whether that tag derives from the root tag <tt class="docutils literal">pod</tt>.
Simply, if the Request type’s nested <tt class="docutils literal">tag</tt> type derives from
<tt class="docutils literal">boost::network::tags::pod</tt> then it chooses to enforce the Pod Server Request
Concept, otherwise it chooses the Normal Client Request Concept.

Normal Client Request Concept¶

A type models the Normal Client Request Concept if it models the Message
Concept and also supports the following constructs.

Legend

<col class="field-name" />
<col class="field-body" />

R:	The request type.

r:	An instance of R.

S:	The string type.

s:	An instance of S.

P:	The port type.

p:	An instance of P.

<colgroup>
<col width="30%" />
<col width="17%" />
<col width="53%" />
</colgroup>

Construct
Result
Description

<tt class="docutils literal">R::string_type</tt>
<tt class="docutils literal">S</tt>
The nested <tt class="docutils literal">string_type</tt> type.

<tt class="docutils literal">R::port_type</tt>
<tt class="docutils literal">P</tt>
The nested <tt class="docutils literal">port_type</tt> type.

<tt class="docutils literal">R r(s)</tt>
NA
Construct a Request with an <tt class="docutils literal">s</tt>
provided. This treats <tt class="docutils literal">s</tt> as the URI
to where the request is destined for.

<tt class="docutils literal">host(request)</tt>
Convertible
to <tt class="docutils literal">S</tt>
Return the host to where the request
is destined for.

<tt class="docutils literal">port(request)</tt>
Convertible
to <tt class="docutils literal">P</tt>
Return the port to where the request
is destined for.

<tt class="docutils literal">path(request)</tt>
Convertible
to <tt class="docutils literal">S</tt>
Return the path included in the URI.

<tt class="docutils literal">query(request)</tt>
Convertible
to <tt class="docutils literal">S</tt>
Return the query part of the URI.

<tt class="docutils literal">anchor(request)</tt>
Convertible
to <tt class="docutils literal">S</tt>
Return the anchor part of the URI.

<tt class="docutils literal">protocol(request)</tt>
Convertible
to <tt class="docutils literal">S</tt>
Return the protocol/scheme part of the
URI.

<tt class="docutils literal">r << uri(s)</tt>
<tt class="docutils literal">R&</tt>
Set the URI of the request.

<tt class="docutils literal">uri(r, s)</tt>
<tt class="docutils literal">void</tt>
Set the URI of the request.

Pod Server Request Concept¶

A type models the Pod Server Request Concept if it models the Message Concept
and also supports the following constructs.

Legend

<col class="field-name" />
<col class="field-body" />

R:	The request type.

r:	An instance of R.

S:	The string type.

I:	An unsigned 8 bit integer.

V:	The vector type for headers.

<colgroup>
<col width="41%" />
<col width="11%" />
<col width="49%" />
</colgroup>

Construct
Result
Description

<tt class="docutils literal">R::string_type</tt>
<tt class="docutils literal">S</tt>
The nested <tt class="docutils literal">string_type</tt> type.

<tt class="docutils literal">R::headers_container_type</tt>
<tt class="docutils literal">V</tt>
The nested
<tt class="docutils literal">headers_container_type</tt> type.

<tt class="docutils literal">r.source</tt>
<tt class="docutils literal">S</tt>
The nested source of the request.

<tt class="docutils literal">r.method</tt>
<tt class="docutils literal">S</tt>
The method of the request.

<tt class="docutils literal">r.destination</tt>
<tt class="docutils literal">S</tt>
The destination of the request.
This is normally the URI of the
request.

<tt class="docutils literal">r.version_major</tt>
<tt class="docutils literal">I</tt>
The major version number part of
the request.

<tt class="docutils literal">r.version_minor</tt>
<tt class="docutils literal">I</tt>
The minor version number part of
the request.

<tt class="docutils literal">r.headers</tt>
<tt class="docutils literal">V</tt>
The vector of headers.

<tt class="docutils literal">r.body</tt>
<tt class="docutils literal">S</tt>
The body of the request.

Directives¶

This section details the provided directives that are provided by
<tt class="xref py py-mod docutils literal">cpp-netlib</tt>. The section was written to assume that an appropriately
constructed request instance is either of the following:

boost::network::http::basic_request<
  boost::network::http::tags::http_default_8bit_udp_resolve
> request;

// or

boost::network::http::basic_request<
  boost::network::http::tags::http_server
> request;

The section also assumes that there following using namespace declaration is in
effect:

using namespace boost::network;

Directives are meant to be used in the following manner:

request << directive(...);

Warning

There are two versions of directives, those that are applicable to
messages that support narrow strings (<tt class="docutils literal">std::string</tt>) and those that are
applicable to messages that support wide strings (<tt class="docutils literal">std::wstring</tt>). The
<tt class="xref py py-mod docutils literal">cpp-netlib</tt> implementation still does not convert wide strings into
UTF-8 encoded narrow strings. This will be implemented in subsequent
library releases.

For now all the implemented directives are listed, even if some of them still
do not implement things correctly.

unspecified <tt class="docutils literal">source(std::string const & source_)</tt>

Create a source directive with a <tt class="docutils literal">std::string</tt> as a parameter, to be set
as the source of the request.

unspecified <tt class="docutils literal">source(std::wstring const & source_)</tt>

Create a source directive with a <tt class="docutils literal">std::wstring</tt> as a parameter, to be set
as the source of the request.

unspecified <tt class="docutils literal">destination(std::string const & source_)</tt>

Create a destination directive with a <tt class="docutils literal">std::string</tt> as a parameter, to be
set as the destination of the request.

unspecified <tt class="docutils literal">destination(std::wstring const & source_)</tt>

Create a destination directive with a <tt class="docutils literal">std::wstring</tt> as a parameter, to be
set as the destination of the request.

unspecified <tt class="docutils literal">header(std::string const & name, std::string const & value)</tt>

Create a header directive that will add the given name and value pair to the
headers already associated with the request. In this case the name and
values are both <tt class="docutils literal">std::string</tt>.

unspecified <tt class="docutils literal">header(std::wstring const & name, std::wstring const & value)</tt>

Create a header directive that will add the given name and value pair to the
headers already associated with the request. In this case the name and
values are both <tt class="docutils literal">std::wstring</tt>.

unspecified <tt class="docutils literal">remove_header(std::string const & name)</tt>

Create a remove_header directive that will remove all the occurences of the
given name from the headers already associated with the request. In this
case the name of the header is of type <tt class="docutils literal">std::string</tt>.

unspecified <tt class="docutils literal">remove_header(std::wstring const & name)</tt>

Create a remove_header directive that will remove all the occurences of the
given name from the headers already associated with the request. In this
case the name of the header is of type <tt class="docutils literal">std::wstring</tt>.

unspecified <tt class="docutils literal">body(std::string const & body_)</tt>

Create a body directive that will set the request’s body to the given
parameter. In this case the type of the body is an <tt class="docutils literal">std::string</tt>.

unspecified <tt class="docutils literal">body(std::wstring const & body_)</tt>

Create a body directive that will set the request’s body to the given
parameter. In this case the type of the body is an <tt class="docutils literal">std::wstring</tt>.

Modifiers¶

This section details the provided modifiers that are provided by
<tt class="xref py py-mod docutils literal">cpp-netlib</tt>.

<tt class="docutils literal">template <class Tag> inline void source(basic_request<Tag> & request, typename string<Tag>::type const & source_)</tt>

Modifies the source of the given <tt class="docutils literal">request</tt>. The type of <tt class="docutils literal">source_</tt> is
dependent on the <tt class="docutils literal">Tag</tt> specialization of <tt class="docutils literal">basic_request</tt>.

<tt class="docutils literal">template <class Tag> inline void destination(basic_request<Tag> & request, typename string<Tag>::type const & destination_)</tt>

Modifies the destination of the given <tt class="docutils literal">request</tt>. The type of <tt class="docutils literal">destination_</tt> is
dependent on the <tt class="docutils literal">Tag</tt> specialization of <tt class="docutils literal">basic_request</tt>.

<tt class="docutils literal">template <class Tag> inline void add_header(basic_request<Tag> & request, typename string<Tag>::type const & name, typename string<Tag>::type const & value)</tt>

Adds a header to the given <tt class="docutils literal">request</tt>. The type of the <tt class="docutils literal">name</tt> and
<tt class="docutils literal">value</tt> parameters are dependent on the <tt class="docutils literal">Tag</tt> specialization of
<tt class="docutils literal">basic_request</tt>.

<tt class="docutils literal">template <class Tag> inline void remove_header(basic_request<Tag> & request, typename string<Tag>::type const & name)</tt>

Removes a header from the given <tt class="docutils literal">request</tt>. The type of the <tt class="docutils literal">name</tt>
parameter is dependent on the <tt class="docutils literal">Tag</tt> specialization of <tt class="docutils literal">basic_request</tt>.

<tt class="docutils literal">template <class Tag> inline void clear_headers(basic_request<Tag> & request)</tt>

Removes all headers from the given <tt class="docutils literal">request</tt>.

<tt class="docutils literal">template <class Tag> inline void body(basic_request<Tag> & request, typename string<Tag>::type const & body_)</tt>

Modifies the body of the given <tt class="docutils literal">request</tt>. The type of <tt class="docutils literal">body_</tt> is
dependent on the <tt class="docutils literal">Tag</tt> specialization of <tt class="docutils literal">basic_request</tt>.

Wrappers¶

This section details the provided request wrappers that come with
<tt class="xref py py-mod docutils literal">cpp-netlib</tt>. Wrappers are used to convert a message into a different type,
usually providing accessor operations to retrieve just part of the message. This
section assumes that the following using namespace directives are in
effect:

using namespace boost::network;
using namespace boost::network::http;

<tt class="docutils literal">template <class Tag></tt> unspecified <tt class="docutils literal">source(basic_request<Tag> const & request)</tt>

Returns a wrapper convertible to <tt class="docutils literal">typename string<Tag>::type</tt> that
provides the source of a given request.

<tt class="docutils literal">template <class Tag></tt> unspecified <tt class="docutils literal">destination(basic_request<Tag> const & request)</tt>

Returns a wrapper convertible to <tt class="docutils literal">typename string<Tag>::type</tt> that
provides the destination of a given request.

<tt class="docutils literal">template <class Tag></tt> unspecified <tt class="docutils literal">headers(basic_request<Tag> const & request)</tt>

Returns a wrapper convertible to <tt class="docutils literal">typename headers_range<basic_request<Tag>
>::type</tt> or <tt class="docutils literal">typename basic_request<Tag>::headers_container_type</tt> that
provides the headers of a given request.

<tt class="docutils literal">template <class Tag></tt> unspecified <tt class="docutils literal">body(basic_request<Tag> const & request)</tt>

Returns a wrapper convertible to <tt class="docutils literal">typename string<Tag>::type</tt> that
provides the body of a given request.

Table Of Contents

HTTP Request

Request Concepts

Normal Client Request Concept

Pod Server Request Concept

Directives

Modifiers

Wrappers

Previous topic

HTTP Client API

Next topic

HTTP Response

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          next

          previous |

cpp-netlib v0.11.2 »

Reference Manual »

        © Copyright 2008-2014, Glyn Matthews, Dean Michael Berris; 2013 Google, Inc..
      Last updated on Aug 27, 2015.
      Created using Sphinx 1.2.2.

redpajama_set_name: RedPajamaGithub


text:
We TicTacToe up in here.

## HSC SDD Minor Project


text:
package com.svcet.cashportal.rest;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.svcet.cashportal.domain.OrganizationMaster;
import com.svcet.cashportal.domain.UserMaster;
import com.svcet.cashportal.security.config.UserNamePasswordOrganizationAuthenticationToken;
import com.svcet.cashportal.service.MenuService;
import com.svcet.cashportal.service.OraganizationService;
import com.svcet.cashportal.service.UserService;
import com.svcet.cashportal.web.beans.MenuResponse;

@RestController
public class MenuController {

	@Autowired
	private MenuService menuService;

	@Autowired
	private UserService userService;

	@Autowired
	private OraganizationService oraganizationService;

	@RequestMapping(method = RequestMethod.GET, value = "/usermenus")
	@ResponseBody
	public MenuResponse[] findAll() {
		UserNamePasswordOrganizationAuthenticationToken authenticationToken = (UserNamePasswordOrganizationAuthenticationToken) SecurityContextHolder
				.getContext().getAuthentication();
		final String userName = authenticationToken.getName();
		final String orgName = authenticationToken.getOrganization();
		OrganizationMaster organizationMaster = oraganizationService.findByOrgName(orgName);
		UserMaster userMaster = userService.findOneByUserNameAndOrgId(userName, organizationMaster.getRid());
		List<MenuResponse> menuReponseList = menuService.getUserMenus(userMaster);
		return menuReponseList.toArray(new MenuResponse[menuReponseList.size()]);
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".ui.activity.utils.SaveToolAndPreferenceActivity">

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!" />
</ScrollView>


text:
function MediaPlayerControl(mediaElement) {
  this.selectorQuery = mediaElement;
  this.mediaElement = $(mediaElement);
  this.volume = 0;
  this.time = 0;
  this.isPaused = false;
  this.isMouseDown = false;
  this.startX = 0;

  this.hideAllControls();
  this.createEvents();
  this.reset(0);
}

MediaPlayerControl.prototype.getState = function() {
  return {
    volume: this.volume,
    isPaused: this.isPaused,
    seekPercent: this.seekPercent
  }
}

MediaPlayerControl.prototype.hideAllControls = function() {
  $(this.mediaElement).find(".toggle-tooltip").css("visibility", "hidden");
  // document.body.removeEventListener('click', this.hideAllControls.bind(this));
}

MediaPlayerControl.prototype.removeEvents = function() {
  $(this.mediaElement).find(".play-pause").off("click");
  $(this.mediaElement).find(".volume-symbol").off("click");
  $(this.mediaElement).find(".volume-control .seekbar-max-length").off("click");
  $(this.mediaElement).find(".seek-bar-control .seekbar-max-length").off("click");
  $(this.mediaElement).find(".volume-control .seeker").off("mousedown");
  $(this.mediaElement).find(".volume-control .seeker").off("mousemove");
  $(this.mediaElement).find(".volume-control .seeker").off("mouseup");
  $(this.mediaElement).find(".seek-bar-control .seeker").off("mousedown");
  $(this.mediaElement).find(".seek-bar-control .seeker").off("mousemove");
  $(this.mediaElement).find(".seek-bar-control .seeker").off("mouseup");
}

MediaPlayerControl.prototype.createEvents = function() {
  this.removeEvents();
  var self = this;
  $(this.mediaElement).find(".play-pause").on("click", this.handlePlayPauseClick.bind(this));
  $(this.mediaElement).find(".volume-symbol").on("click", this.handleVolumeClick.bind(this));

  $(this.mediaElement).find(".volume-control .seekbar-max-length").on("click", this.handleSeekbarClick.bind(this, function(value) {
    this.volume = value;
    $(this.mediaElement).trigger("volume-seekbar-click", this.getState());
  }));

  $(this.mediaElement).find(".seek-bar-control .seekbar-max-length").on("click", this.handleSeekbarClick.bind(this, function(seekPercent) {
    this.seekPercent = seekPercent;
    $(this.mediaElement).trigger("seeker-seekbar-click", this.getState());
  }));

  $(this.mediaElement).find(".volume-control .seeker").on("mousedown", this.mouseDown.bind(this));
  $(this.mediaElement).find(".volume-control .seeker").on("mousemove", function(event) {
    self.drag(event, function(seekPercent) {
      this.volume = seekPercent;
      $(this.mediaElement).trigger("volume-seekbar-drag", this.getState());
    });
  });
  $(this.mediaElement).find(".volume-control .seeker").on("mouseup", this.mouseUp.bind(this));

  $(this.mediaElement).find(".seek-bar-control .seeker").on("mousedown", this.mouseDown.bind(this));
  $(this.mediaElement).find(".seek-bar-control .seeker").on("mousemove", function(event) {
    self.drag(event, function(seekPercent) {
      this.seekPercent = seekPercent;
      $(this.mediaElement).trigger("seeker-seekbar-drag", this.getState());
    });
  });
  $(this.mediaElement).find(".seek-bar-control .seeker").on("mouseup", this.mouseUp.bind(this));
}

MediaPlayerControl.prototype.handlePlayPauseClick = function(event) {
  event.stopPropagation();
  this.handlePlayPause();
}

MediaPlayerControl.prototype.handleVolumeClick = function(event) {
  event.stopPropagation();
  var element = $(this.mediaElement).find(".volume-symbol");
  element.toggleClass("selected");
  if(element.hasClass("selected")) {
    $(this.mediaElement).find(".volume-control .seek-bar").css("visibility", "visible");
    // document.body.addEventListener('click', this.hideAllControls.bind(this));
  } else {
      $(this.mediaElement).find(".volume-control .seek-bar").css("visibility", "hidden");
  }

}

MediaPlayerControl.prototype.handleSeekbarClick = function(callback, event) {
  if($(event.target).hasClass("seeker")) {
    return;
  }
  var rootElement = $(event.target).parents(".control");
  var element = rootElement.find(".seekbar-filled");
  element.css("width", event.offsetX + "px");
  element.find(".seeker").css("left", event.offsetX + "px");
  callback.call(this, parseInt((event.offsetX / rootElement.find(".seekbar-max-length").width()) * 100));
}

MediaPlayerControl.prototype.mouseDown = function(event) {
  event.stopPropagation();
  this.callback = null;
  this.isMouseDown = true;
  this.startX = event.pageX;
  this.draggedElement = event.target;
  document.body.addEventListener('mousemove', this.drag.bind(this));
  document.body.addEventListener('mouseup', this.mouseUp.bind(this));
}

MediaPlayerControl.prototype.drag = function(event, callback) {

  event.stopPropagation();
  if(!this.isMouseDown) {
    return;
  }

  if(callback && !this.callback) {
    this.callback = callback;
  }

  var rootElement = $(this.draggedElement).parents(".control");
  var seekbarParent = rootElement.find(".seekbar-max-length");
  var seekbar = seekbarParent.find(".seeker");
  var left = event.pageX - seekbarParent.offset().left;
  var oldLeft = parseFloat($(seekbar).css("left"));
  var seekbarWidth = seekbarParent.width();

  if(left > seekbarWidth) {
    left = seekbarWidth;
  }

  if(left < 0) {
    left = 0;
  }

  $(seekbar).css("left", left + "px");
  rootElement.find(".seekbar-filled").css("width", left + "px");
  this.callback.call(this, parseInt((left / seekbarWidth) * 100));
  this.startX = event.pageX;
}

MediaPlayerControl.prototype.mouseUp = function(event) {
  document.body.removeEventListener('mousemove', this.drag.bind(this));
  document.body.removeEventListener('mouseup', this.mouseUp.bind(this));
  this.isMouseDown = false;
  this.draggedElement = null;
  this.callback = null;
}

MediaPlayerControl.prototype.setSeek = function(value) {
  var maxBar = $(this.mediaElement).find(".seek-bar-control .seekbar-max-length");
  var seekbarFilled = $(this.mediaElement).find(".seek-bar-control .seekbar-filled");
  var seekInPixels = maxBar.width() * value;
  seekbarFilled.css("width", seekInPixels + "px");
  seekbarFilled.find(".seeker").css("left", seekInPixels + "px");
  $(".current-length").html(0);
  $(".total-length").html(0);
}

MediaPlayerControl.prototype.updateOnSeek = function(currentTime, totalTime) {
  var currentTimeString = this.getTime(currentTime);
  var totalTimeString = this.getTime(totalTime);
  var seekPercent = (currentTime / totalTime) * 100;
  var maxBar = $(this.mediaElement).find(".seek-bar-control .seekbar-max-length");
  var seekbarFilled = $(this.mediaElement).find(".seek-bar-control .seekbar-filled");
  var seekInPixels = maxBar.width() * seekPercent / 100;

  seekbarFilled.css("width", seekInPixels + "px");
  seekbarFilled.find(".seeker").css("left", seekInPixels + "px");
  $(".current-length").html(currentTimeString);
  $(".total-length").html(totalTimeString);

}

MediaPlayerControl.prototype.getTime = function(currentTime) {
  var minutes = Math.floor(currentTime / 60000);
  var seconds = ((currentTime % 60000) / 1000).toFixed(0);
  return minutes + ":" + (seconds < 10 ? '0' : '') + seconds;
}

MediaPlayerControl.prototype.setVolume = function(volume) {
  var maxBar = $(this.mediaElement).find(".volume-control .seekbar-max-length");
  var seekbarFilled = $(this.mediaElement).find(".volume-control .seekbar-filled");
  var seekInPixels = maxBar.width() * volume;
  seekbarFilled.css("width", seekInPixels + "px");
  seekbarFilled.find(".seeker").css("left", seekInPixels + "px");
}

MediaPlayerControl.prototype.play = function() {
  this.handlePlayPause();
}

MediaPlayerControl.prototype.pause = function() {
  this.handlePlayPause();
}

MediaPlayerControl.prototype.handlePlayPause = function() {
  var element = $(this.mediaElement).find(".play-pause");
  element.toggleClass("selected")
  .removeClass("fa-play")
  .removeClass("fa-pause")
  .addClass(element.hasClass("selected") ? "fa-play" : "fa-pause");
  this.isPaused = element.hasClass("selected");
  $(this.mediaElement).trigger("play-pause-click", this.getState());
}

MediaPlayerControl.prototype.reset = function() {
  this.setSeek(0);
  $(this.mediaElement).find(".volume-symbol").removeClass("selected");
}


text:
import time
import six
from azure.core.pipeline import PipelineRequest
from azure.core.pipeline.policies import SansIOHTTPPolicy
from .._base_handler import ServiceBusSharedKeyCredential

class ServiceBusSharedKeyCredentialPolicy(SansIOHTTPPolicy):
    """A policy that put token generated by ServiceBusSharedKeyCredential into HTTP request header

    :param str endpoint:
    :param ServiceBusSharedKeyCredential credential:
    :param str name:
    """

    def __init__(self, endpoint, credential, name):
        # type: (str, ServiceBusSharedKeyCredential, str) -> None
        super(ServiceBusSharedKeyCredentialPolicy, self).__init__()
        self._credential = credential
        self._endpoint = endpoint
        if not name:
            raise ValueError("name can not be None or empty")
        if not isinstance(name, six.string_types):
            raise TypeError("name must be a string.")
        self._name = name
        self._token_expiry_on = 0
        self._token = None

    def _update_token(self):
        if (
            self._token_expiry_on + 60 <= time.time()
        ):  # Update token if it's expiring in 60 seconds
            access_token, self._token_expiry_on = self._credential.get_token(
                self._endpoint
            )
            self._token = access_token.decode("utf-8")

    def on_request(self, request):
        # type: (PipelineRequest) -> None
        """Adds an Authorization header to request and sends request to next policy.

        :param request: The pipeline request object
        :type request: ~azure.core.pipeline.PipelineRequest
        """
        self._update_token()
        request.http_request.headers[self._name] = self._token


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

    <LinearLayout
        android:id="@android:id/primary"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"/>

    <LinearLayout
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@android:id/primary"
        android:orientation="vertical"/>
</RelativeLayout>


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Tags on klue-less thoughts</title>
    <link>https://klue.github.io/tags/</link>
    <description>Recent content in Tags on klue-less thoughts</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 05 Sep 2017 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://klue.github.io/tags/" rel="self" type="application/rss+xml" />

    <item>
      <title>Exploitation</title>
      <link>https://klue.github.io/tags/exploitation/</link>
      <pubDate>Tue, 05 Sep 2017 00:00:00 +0000</pubDate>

      <guid>https://klue.github.io/tags/exploitation/</guid>
      <description></description>
    </item>

    <item>
      <title>Hevd</title>
      <link>https://klue.github.io/tags/hevd/</link>
      <pubDate>Tue, 05 Sep 2017 00:00:00 +0000</pubDate>

      <guid>https://klue.github.io/tags/hevd/</guid>
      <description></description>
    </item>

    <item>
      <title>Kernel Debugging</title>
      <link>https://klue.github.io/tags/kernel-debugging/</link>
      <pubDate>Mon, 10 Apr 2017 00:00:00 +0000</pubDate>

      <guid>https://klue.github.io/tags/kernel-debugging/</guid>
      <description></description>
    </item>

    <item>
      <title>Macos</title>
      <link>https://klue.github.io/tags/macos/</link>
      <pubDate>Mon, 10 Apr 2017 00:00:00 +0000</pubDate>

      <guid>https://klue.github.io/tags/macos/</guid>
      <description></description>
    </item>

    <item>
      <title>Password Managers</title>
      <link>https://klue.github.io/tags/password-managers/</link>
      <pubDate>Thu, 02 Mar 2017 00:00:00 +0000</pubDate>

      <guid>https://klue.github.io/tags/password-managers/</guid>
      <description></description>
    </item>

    <item>
      <title>Passwords</title>
      <link>https://klue.github.io/tags/passwords/</link>
      <pubDate>Thu, 02 Mar 2017 00:00:00 +0000</pubDate>

      <guid>https://klue.github.io/tags/passwords/</guid>
      <description></description>
    </item>

    <item>
      <title>Pegasus</title>
      <link>https://klue.github.io/tags/pegasus/</link>
      <pubDate>Tue, 07 Mar 2017 00:00:00 +0000</pubDate>

      <guid>https://klue.github.io/tags/pegasus/</guid>
      <description></description>
    </item>

    <item>
      <title>Trident</title>
      <link>https://klue.github.io/tags/trident/</link>
      <pubDate>Tue, 07 Mar 2017 00:00:00 +0000</pubDate>

      <guid>https://klue.github.io/tags/trident/</guid>
      <description></description>
    </item>

    <item>
      <title>Virtualbox</title>
      <link>https://klue.github.io/tags/virtualbox/</link>
      <pubDate>Mon, 10 Apr 2017 00:00:00 +0000</pubDate>

      <guid>https://klue.github.io/tags/virtualbox/</guid>
      <description></description>
    </item>

    <item>
      <title>Windows</title>
      <link>https://klue.github.io/tags/windows/</link>
      <pubDate>Tue, 05 Sep 2017 00:00:00 +0000</pubDate>

      <guid>https://klue.github.io/tags/windows/</guid>
      <description></description>
    </item>

  </channel>
</rss>


text:
using namespace luacpp;
using namespace convert;

namespace
{
	int testCFunction(lua_State* state)
	{
		return 0;
	}
}

class LuaConvertTest : public LuaStateTest
{
};

TEST_F(LuaConvertTest, PushDouble)
{
	ScopedLuaStackTest stackTest(L);

	pushValue(L, 1.0);

	ASSERT_TRUE(lua_isnumber(L, -1) == 1);
	ASSERT_DOUBLE_EQ(1.0, lua_tonumber(L, -1));

	lua_pop(L, 1);
}

TEST_F(LuaConvertTest, PushFloat)
{
	ScopedLuaStackTest stackTest(L);

	pushValue(L, 1.0f);

	ASSERT_TRUE(lua_isnumber(L, -1) == 1);
	ASSERT_DOUBLE_EQ(1.0, lua_tonumber(L, -1));

	lua_pop(L, 1);
}

TEST_F(LuaConvertTest, PushInt)
{
	ScopedLuaStackTest stackTest(L);

	pushValue(L, 1);

	ASSERT_TRUE(lua_isnumber(L, -1) == 1);
	ASSERT_DOUBLE_EQ(1.0, lua_tonumber(L, -1));

	lua_pop(L, 1);
}

TEST_F(LuaConvertTest, PushSizeT)
{
	ScopedLuaStackTest stackTest(L);

	pushValue(L, static_cast<size_t>(1));

	ASSERT_TRUE(lua_isnumber(L, -1) == 1);
	ASSERT_DOUBLE_EQ(1.0, lua_tonumber(L, -1));

	lua_pop(L, 1);
}

TEST_F(LuaConvertTest, PushStdString)
{
	ScopedLuaStackTest stackTest(L);

	std::string testStr("TestTest");
	pushValue(L, testStr);

	ASSERT_TRUE(lua_isstring(L, -1) == 1);
	ASSERT_STREQ("TestTest", lua_tostring(L, -1));

	lua_pop(L, 1);
}

TEST_F(LuaConvertTest, PushString)
{
	ScopedLuaStackTest stackTest(L);

	const char* string = "TestTest";
	pushValue(L, string);

	ASSERT_TRUE(lua_isstring(L, -1) == 1);
	ASSERT_STREQ(string, lua_tostring(L, -1));

	lua_pop(L, 1);
}

TEST_F(LuaConvertTest, PushBool)
{
	ScopedLuaStackTest stackTest(L);

	pushValue(L, true);

	ASSERT_TRUE(lua_isboolean(L, -1) == 1);
	ASSERT_TRUE(lua_toboolean(L, -1) == 1);

	lua_pop(L, 1);

	pushValue(L, false);

	ASSERT_TRUE(lua_isboolean(L, -1) == 1);
	ASSERT_FALSE(lua_toboolean(L, -1) == 1);

	lua_pop(L, 1);
}

TEST_F(LuaConvertTest, PushCFunction)
{
	ScopedLuaStackTest stackTest(L);

	pushValue(L, &testCFunction);

	ASSERT_TRUE(lua_iscfunction(L, -1) == 1);

	lua_pop(L, 1);
}

TEST_F(LuaConvertTest, PushValue)
{
	ScopedLuaStackTest stackTest(L);

	LuaTable table = LuaTable::create(L);

	pushValue<LuaValue>(L, table);

	ASSERT_TRUE(lua_istable(L, -1) == 1);

	lua_pop(L, 1);
}

TEST_F(LuaConvertTest, PushFunction)
{
	ScopedLuaStackTest stackTest(L);

	LuaFunction func = LuaFunction::createFromCode(L, "return 0");

	pushValue<LuaValue>(L, func);

	ASSERT_TRUE(lua_isfunction(L, -1) == 1 && !lua_iscfunction(L, -1));

	lua_pop(L, 1);
}

TEST_F(LuaConvertTest, PopDouble)
{
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		double target;
		ASSERT_TRUE(popValue(L, target));

		ASSERT_DOUBLE_EQ(1.0, target);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		double target;
		ASSERT_TRUE(popValue(L, target, -1, false));

		ASSERT_DOUBLE_EQ(1.0, target);
		ASSERT_TRUE(lua_isnumber(L, -1) == 1);

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushboolean(L, 1);

		double target;
		ASSERT_FALSE(popValue(L, target));

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		double target = popValue<double>(L);

		ASSERT_DOUBLE_EQ(1.0, target);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		double target = popValue<double>(L, -1, false);

		ASSERT_DOUBLE_EQ(1.0, target);
		ASSERT_TRUE(lua_isnumber(L, -1) == 1);

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushliteral(L, "TestTest");

		ASSERT_THROW(popValue<double>(L), LuaException);

		lua_pop(L, 1);
	}
}

TEST_F(LuaConvertTest, PopFloat)
{
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		float target;
		ASSERT_NO_THROW(target = popValue<float>(L));

		ASSERT_FLOAT_EQ(1.0f, target);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		float target;
		ASSERT_NO_THROW(target = popValue<float>(L, -1, false));

		ASSERT_FLOAT_EQ(1.0f, target);
		ASSERT_TRUE(lua_isnumber(L, -1) == 1);

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushboolean(L, 1);

		ASSERT_THROW(popValue<float>(L), LuaException);

		lua_pop(L, 1);
	}
}

TEST_F(LuaConvertTest, PopInt)
{
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		int target;
		ASSERT_NO_THROW(target = popValue<int>(L));

		ASSERT_EQ(1, target);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		int target;
		ASSERT_NO_THROW(target = popValue<int>(L, -1, false));

		ASSERT_EQ(1, target);
		ASSERT_TRUE(lua_isnumber(L, -1) == 1);

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushboolean(L, 1);

		ASSERT_THROW(popValue<int>(L), LuaException);

		lua_pop(L, 1);
	}
}

TEST_F(LuaConvertTest, PopSizeT)
{
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		size_t target;
		ASSERT_NO_THROW(target = popValue<size_t>(L));

		ASSERT_EQ(1, target);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		size_t target;
		ASSERT_NO_THROW(target = popValue<size_t>(L, -1, false));

		ASSERT_EQ(1, target);
		ASSERT_TRUE(lua_isnumber(L, -1) == 1);

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushboolean(L, 1);

		ASSERT_THROW(popValue<size_t>(L), LuaException);

		lua_pop(L, 1);
	}
}

TEST_F(LuaConvertTest, PopStdString)
{
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushliteral(L, "TestTest");

		std::string target;
		ASSERT_NO_THROW(target = popValue<std::string>(L));

		ASSERT_STREQ("TestTest", target.c_str());
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushliteral(L, "TestTest");

		std::string target;
		ASSERT_NO_THROW(target = popValue<std::string>(L, -1, false));

		ASSERT_STREQ("TestTest", target.c_str());
		ASSERT_TRUE(lua_isstring(L, -1) == 1);

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushboolean(L, 1);

		ASSERT_THROW(popValue<std::string>(L), LuaException);

		lua_pop(L, 1);
	}
}

TEST_F(LuaConvertTest, PopBool)
{
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushboolean(L, 1);

		bool target;
		ASSERT_NO_THROW(target = popValue<bool>(L));

		ASSERT_TRUE(target);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushboolean(L, 1);

		bool target;
		ASSERT_NO_THROW(target = popValue<bool>(L, -1, false));

		ASSERT_TRUE(target);
		ASSERT_TRUE(lua_isboolean(L, -1) == 1);

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		ASSERT_THROW(popValue<bool>(L), LuaException);

		lua_pop(L, 1);
	}
}

TEST_F(LuaConvertTest, PopCFunction)
{
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushcfunction(L, &testCFunction);

		lua_CFunction target;
		ASSERT_NO_THROW(target = popValue<lua_CFunction>(L));

		ASSERT_EQ(target, &testCFunction);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushcfunction(L, &testCFunction);

		lua_CFunction target;
		ASSERT_NO_THROW(target = popValue<lua_CFunction>(L, -1, false));

		ASSERT_EQ(target, &testCFunction);
		ASSERT_TRUE(lua_iscfunction(L, -1) == 1);

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		ASSERT_THROW(popValue<lua_CFunction>(L), LuaException);

		lua_pop(L, 1);
	}
}

TEST_F(LuaConvertTest, PopLuaTable)
{
	{
		ScopedLuaStackTest stackTest(L);

		lua_newtable(L);

		LuaTable target;
		ASSERT_NO_THROW(target = popValue<LuaTable>(L));

		ASSERT_EQ(ValueType::TABLE, target.getValueType());
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_newtable(L);

		LuaTable target;
		ASSERT_NO_THROW(target = popValue<LuaTable>(L, -1, false));

		ASSERT_EQ(ValueType::TABLE, target.getValueType());
		ASSERT_TRUE(lua_istable(L, -1) == 1);

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		ASSERT_THROW(popValue<LuaTable>(L), LuaException);

		lua_pop(L, 1);
	}
}

TEST_F(LuaConvertTest, PopLuaFunction)
{
	{
		ScopedLuaStackTest stackTest(L);

		// Put the print function onto the stack
		lua_getglobal(L, "print");

		LuaFunction target;
		ASSERT_NO_THROW(target = popValue<LuaFunction>(L));

		ASSERT_EQ(ValueType::FUNCTION, target.getValueType());
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_getglobal(L, "print");

		LuaFunction target;
		ASSERT_NO_THROW(target = popValue<LuaFunction>(L, -1, false));

		ASSERT_EQ(ValueType::FUNCTION, target.getValueType());
		ASSERT_TRUE(lua_isfunction(L, -1) == 1);

		lua_pop(L, 1);
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		ASSERT_THROW(popValue<LuaFunction>(L), LuaException);

		lua_pop(L, 1);
	}
}

TEST_F(LuaConvertTest, PopLuaValue)
{
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		LuaValue target;
		ASSERT_NO_THROW(target = popValue<LuaValue>(L));

		ASSERT_EQ(ValueType::NUMBER, target.getValueType());
	}
	{
		ScopedLuaStackTest stackTest(L);

		lua_pushnumber(L, 1.0);

		LuaValue target;
		ASSERT_NO_THROW(target = popValue<LuaValue>(L, -1, false));

		ASSERT_EQ(ValueType::NUMBER, target.getValueType());
		ASSERT_TRUE(lua_isnumber(L, -1) == 1);

		lua_pop(L, 1);
	}
}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.07.27 at 08:11:57 PM EEST
//

package uk.org.siri.siri;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

/**
 * Type for list of situations.
 *
 *
Java class for ActionDataStructure complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="ActionDataStructure">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="Name" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN"/>
 *         <element name="Type" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN"/>
 *         <element name="Value" type="{http://www.w3.org/2001/XMLSchema}anyType" maxOccurs="unbounded"/>
 *         <element name="Prompt" type="{http://www.siri.org.uk/siri}NaturalLanguageStringStructure" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ActionDataStructure", propOrder = {
    "name",
    "type",
    "value",
    "prompt"
})
public class ActionDataStructure {

    @XmlElement(name = "Name", required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    @XmlSchemaType(name = "NMTOKEN")
    protected String name;
    @XmlElement(name = "Type", required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    @XmlSchemaType(name = "NMTOKEN")
    protected String type;
    @XmlElement(name = "Value", required = true)
    protected List<Object> value;
    @XmlElement(name = "Prompt")
    protected NaturalLanguageStringStructure prompt;

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setName(String value) {
        this.name = value;
    }

    /**
     * Gets the value of the type property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getType() {
        return type;
    }

    /**
     * Sets the value of the type property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setType(String value) {
        this.type = value;
    }

    /**
     * Gets the value of the value property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the value property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getValue().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Object }
     *
     *
     */
    public List<Object> getValue() {
        if (value == null) {
            value = new ArrayList<Object>();
        }
        return this.value;
    }

    /**
     * Gets the value of the prompt property.
     *
     * @return
     *     possible object is
     *     {@link NaturalLanguageStringStructure }
     *
     */
    public NaturalLanguageStringStructure getPrompt() {
        return prompt;
    }

    /**
     * Sets the value of the prompt property.
     *
     * @param value
     *     allowed object is
     *     {@link NaturalLanguageStringStructure }
     *
     */
    public void setPrompt(NaturalLanguageStringStructure value) {
        this.prompt = value;
    }

}


text:
ActiveRecord::Schema.define(:version => 20100709223632) do

  create_table "achievement_criteria", :force => true do |t|
    t.integer "meta_id"
    t.integer "achievement_id"
    t.integer "max_quantity"
    t.integer "quantity"
  end

  add_index "achievement_criteria", ["achievement_id"], :name => "index_achievement_criteria_on_achievement_id"

  create_table "achievement_data", :force => true do |t|
    t.integer "achievement_id"
    t.boolean "is_statistic",   :null => false
    t.boolean "is_heroic",      :null => false
    t.boolean "is_meta",        :null => false
    t.integer "players"
    t.string  "name"
    t.string  "icon"
  end

  add_index "achievement_data", ["achievement_id"], :name => "index_achievement_data_on_achievement_id"

  create_table "achievements", :force => true do |t|
    t.integer  "character_id"
    t.string   "child_id"
    t.integer  "achievement_id"
    t.datetime "earned_on"
    t.integer  "count"
  end

  add_index "achievements", ["character_id"], :name => "index_achievements_on_character_id"

  create_table "arena_characters", :force => true do |t|
    t.integer "arena_team_id"
    t.string  "character_hash"
    t.integer "played"
    t.integer "won"
    t.integer "season_played"
    t.integer "season_won"
    t.integer "personal_rating"
    t.integer "personal_rank"
  end

  add_index "arena_characters", ["arena_team_id"], :name => "index_arena_characters_on_arena_team_id"
  add_index "arena_characters", ["character_hash"], :name => "index_arena_characters_on_character_hash"

  create_table "arena_teams", :force => true do |t|
    t.string  "name"
    t.integer "rating"
    t.integer "played"
    t.integer "won"
    t.integer "season_played"
    t.integer "season_won"
    t.integer "bracket"
    t.integer "previous_rank"
    t.integer "current_rank"
    t.string  "team_hash"
  end

  add_index "arena_teams", ["team_hash"], :name => "index_arena_teams_on_team_hash"

  create_table "armory_errors", :force => true do |t|
    t.string   "error_type"
    t.string   "class_name"
    t.string   "name_hash"
    t.string   "guild_hash"
    t.integer  "numerical_id"
    t.datetime "created_at"
  end

  add_index "armory_errors", ["class_name"], :name => "index_armory_errors_on_job_type"

  create_table "armory_jobs", :force => true do |t|
    t.string   "class_name"
    t.text     "yaml_args"
    t.integer  "priority"
    t.string   "locked_by"
    t.string   "job_type"
    t.string   "name_hash"
    t.string   "guild_hash"
    t.integer  "numerical_id"
    t.boolean  "local_only"
    t.datetime "locked_at"
    t.datetime "created_at"
    t.string   "region"
    t.integer  "timeout_mod",  :default => 0
    t.integer  "retries",      :default => 0
  end

  add_index "armory_jobs", ["created_at"], :name => "index_armory_jobs_on_created_at"
  add_index "armory_jobs", ["guild_hash"], :name => "index_armory_jobs_on_guild_hash"
  add_index "armory_jobs", ["locked_at"], :name => "index_armory_jobs_on_locked_at"
  add_index "armory_jobs", ["locked_by"], :name => "index_armory_jobs_on_locked_by"
  add_index "armory_jobs", ["name_hash"], :name => "index_armory_jobs_on_name_hash"
  add_index "armory_jobs", ["priority"], :name => "index_armory_jobs_on_priority"

  create_table "armory_stats", :force => true do |t|
    t.string  "date"
    t.string  "region"
    t.integer "characters"
  end

  add_index "armory_stats", ["date"], :name => "index_armory_stats_on_date"

  create_table "character_claims", :force => true do |t|
    t.string   "character_hash"
    t.integer  "user_id"
    t.datetime "created_at"
    t.string   "relationship"
    t.boolean  "is_public"
  end

  add_index "character_claims", ["character_hash"], :name => "index_character_claims_on_character_hash"
  add_index "character_claims", ["user_id"], :name => "index_character_claims_on_user_id"

  create_table "characters", :force => true do |t|
    t.string   "hash_id"
    t.string   "name"
    t.string   "region"
    t.string   "realm"
    t.string   "battlegroup"
    t.string   "guild"
    t.integer  "guild_rank"
    t.string   "guild_hash"
    t.string   "spec_role"
    t.integer  "achievement_points"
    t.integer  "level"
    t.integer  "title_id"
    t.integer  "faction_id"
    t.integer  "race_id"
    t.integer  "class_id"
    t.integer  "gender_id"
    t.datetime "updated_at"
    t.integer  "active_group"
    t.integer  "last_login"
    t.integer  "average_ilvl",                                     :default => 0
    t.decimal  "equip_percent",      :precision => 6, :scale => 3, :default => 0.0
    t.decimal  "gem_percent",        :precision => 6, :scale => 3, :default => 0.0
    t.decimal  "enchant_percent",    :precision => 6, :scale => 3, :default => 0.0
    t.boolean  "has_talents"
    t.boolean  "has_achievements"
    t.boolean  "inactive"
    t.integer  "failed"
  end

  add_index "characters", ["guild_hash"], :name => "index_characters_on_guild_hash"
  add_index "characters", ["hash_id"], :name => "index_characters_on_hash_id"

  create_table "enchant_slots", :force => true do |t|
    t.integer "item_id"
    t.integer "spell_id"
    t.integer "equipment_id"
  end

  add_index "enchant_slots", ["equipment_id"], :name => "index_enchant_slots_on_equipment_id"
  add_index "enchant_slots", ["item_id"], :name => "index_enchant_slots_on_item_id"
  add_index "enchant_slots", ["spell_id"], :name => "index_enchant_slots_on_spell_id"

  create_table "enchants", :force => true do |t|
    t.integer "enchant_id"
    t.string  "name"
    t.string  "spec_type"
    t.string  "icon"
    t.string  "stat_hash"
    t.integer "spell_id"
  end

  add_index "enchants", ["enchant_id"], :name => "index_enchants_on_enchant_id"
  add_index "enchants", ["spec_type"], :name => "index_enchants_on_spec_type"
  add_index "enchants", ["stat_hash"], :name => "index_enchants_on_stat_hash"

  create_table "equipment", :force => true do |t|
    t.integer "character_id"
    t.integer "durability"
    t.integer "group_id"
    t.integer "equipment_id"
    t.integer "item_id"
    t.integer "enchant_spell"
    t.integer "enchant_item"
    t.integer "gem1_id"
    t.integer "gem2_id"
    t.integer "gem3_id"
    t.integer "random_suffix"
  end

  add_index "equipment", ["character_id"], :name => "index_equipment_on_character_id"

  create_table "experiences", :force => true do |t|
    t.integer "character_id"
    t.string  "child_id"
    t.decimal "percent",      :precision => 6, :scale => 2
  end

  add_index "experiences", ["character_id"], :name => "index_experiences_on_character_id"

  create_table "glyph_data", :force => true do |t|
    t.integer "glyph_id"
    t.string  "spec_type"
    t.string  "icon"
    t.string  "name"
    t.integer "item_id"
    t.boolean "is_major"
  end

  add_index "glyph_data", ["glyph_id"], :name => "index_glyph_data_on_glyph_id"

  create_table "glyphs", :force => true do |t|
    t.integer "glyph_id"
    t.integer "talent_id"
    t.integer "character_id"
    t.integer "group_id"
  end

  add_index "glyphs", ["character_id"], :name => "index_glyphs_on_character_id"

  create_table "group_sessions", :force => true do |t|
    t.string   "session_id"
    t.text     "queued_hashes"
    t.text     "character_hashes"
    t.text     "character_ids"
    t.datetime "updated_at"
  end

  add_index "group_sessions", ["session_id"], :name => "index_group_sessions_on_session_id"

  create_table "guilds", :force => true do |t|
    t.string   "hash_id"
    t.string   "region"
    t.string   "realm"
    t.string   "name"
    t.integer  "members"
    t.integer  "faction_id"
    t.datetime "updated_at"
  end

  add_index "guilds", ["hash_id"], :name => "index_guilds_on_hash_id"

  create_table "item_reagents", :force => true do |t|
    t.integer "item_id"
    t.integer "reagent_id"
    t.integer "quantity"
  end

  add_index "item_reagents", ["item_id"], :name => "index_item_reagents_on_item_id"

  create_table "item_sources", :force => true do |t|
    t.integer "item_id"
    t.string  "name"
    t.string  "area"
    t.string  "title"
    t.string  "source_type"
    t.integer "players"
    t.integer "npc_id"
    t.boolean "is_heroic",   :null => false
  end

  add_index "item_sources", ["item_id"], :name => "index_item_sources_on_item_id"

  create_table "item_statistics", :force => true do |t|
    t.integer "character_id"
    t.integer "character_level"
    t.string  "spec_role"
    t.integer "average_ilvl"
    t.integer "equipment_id"
    t.integer "socket_color"
    t.integer "item_type"
    t.integer "item_id"
    t.integer "enchant_id"
  end

  add_index "item_statistics", ["character_id"], :name => "index_item_statistics_on_character_id"
  add_index "item_statistics", ["character_level"], :name => "index_item_statistics_on_character_level"
  add_index "item_statistics", ["enchant_id"], :name => "index_item_statistics_on_enchant_id"
  add_index "item_statistics", ["equipment_id"], :name => "index_item_statistics_on_equipment_id"
  add_index "item_statistics", ["item_id"], :name => "index_item_statistics_on_item_id"
  add_index "item_statistics", ["item_type"], :name => "index_item_statistics_on_item_type"

  create_table "items", :force => true do |t|
    t.integer  "item_id"
    t.string   "name"
    t.integer  "quality"
    t.integer  "level"
    t.integer  "sockets"
    t.integer  "slot_id"
    t.integer  "class_id"
    t.integer  "faction_id"
    t.string   "item_type"
    t.string   "icon"
    t.string   "set_name"
    t.string   "spec_type"
    t.string   "gem1_type"
    t.string   "gem2_type"
    t.string   "gem3_type"
    t.string   "equip_type"
    t.datetime "updated_at"
    t.integer  "token_id"
    t.integer  "token_cost"
    t.boolean  "is_heroic",  :default => false
    t.string   "stat_hash"
  end

  add_index "items", ["equip_type"], :name => "index_items_on_equip_type"
  add_index "items", ["item_id"], :name => "index_items_on_item_id"
  add_index "items", ["item_type"], :name => "index_items_on_item_type"
  add_index "items", ["level"], :name => "index_items_on_level"
  add_index "items", ["slot_id"], :name => "index_items_on_slot_id"
  add_index "items", ["spec_type"], :name => "index_items_on_spec_type"
  add_index "items", ["stat_hash"], :name => "index_items_on_stat_hash"

  create_table "meta_gems", :force => true do |t|
    t.integer "item_id"
    t.text    "requirements"
  end

  add_index "meta_gems", ["item_id"], :name => "index_meta_gems_on_item_id"

  create_table "nodes", :force => true do |t|
    t.boolean  "enabled",    :default => true
    t.boolean  "remote",     :default => true
    t.string   "name"
    t.string   "url"
    t.string   "email"
    t.string   "secret_key"
    t.string   "locked_by"
    t.datetime "locked_at"
    t.integer  "version"
    t.integer  "throttle",   :default => 5
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean  "trusted",    :default => true, :null => false
    t.boolean  "errored"
  end

  add_index "nodes", ["locked_by"], :name => "index_nodes_on_locked_by"

  create_table "pet_talents", :force => true do |t|
    t.integer "character_id"
    t.boolean "active",          :null => false
    t.integer "cat_id"
    t.integer "group"
    t.string  "pet_name"
    t.string  "pet_family_id"
    t.string  "pet_family_name"
    t.string  "pet_npc_id"
    t.string  "pet_npc_name"
    t.string  "pet_level"
    t.string  "tree_type"
    t.integer "sum_tree1"
    t.integer "sum_tree2"
    t.integer "sum_tree3"
    t.string  "compressed_data"
  end

  add_index "pet_talents", ["character_id"], :name => "index_pet_talents_on_character_id"

  create_table "population_stats", :force => true do |t|
    t.string   "region"
    t.string   "realm"
    t.integer  "horde"
    t.integer  "alliance"
    t.datetime "updated_at"
    t.decimal  "average_ilvl", :precision => 6, :scale => 2, :default => 0.0
    t.decimal  "ilvl_change",  :precision => 6, :scale => 2, :default => 0.0
  end

  add_index "population_stats", ["realm"], :name => "index_population_stats_on_realm"
  add_index "population_stats", ["region"], :name => "index_population_stats_on_region"

  create_table "posts", :force => true do |t|
    t.integer  "user_id"
    t.string   "title"
    t.text     "body"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "posts", ["created_at"], :name => "index_posts_on_created_at"

  create_table "profession_data", :force => true do |t|
    t.integer "profession_id"
    t.string  "key"
    t.string  "name"
  end

  add_index "profession_data", ["profession_id"], :name => "index_profession_data_on_profession_id"

  create_table "professions", :force => true do |t|
    t.integer "character_id"
    t.integer "profession_id"
    t.integer "current"
    t.integer "max"
  end

  add_index "professions", ["character_id"], :name => "index_professions_on_character_id"

  create_table "rankings", :force => true do |t|
    t.integer "rank"
    t.string  "region"
    t.string  "realm"
    t.string  "primary_rank"
    t.string  "secondary_rank"
    t.string  "character_hash"
    t.integer "item_id"
    t.decimal "average_ilvl",    :precision => 6, :scale => 2, :default => 0.0
    t.decimal "equip_percent",   :precision => 3, :scale => 2, :default => 0.0
    t.decimal "gem_percent",     :precision => 3, :scale => 2, :default => 0.0
    t.decimal "enchant_percent", :precision => 3, :scale => 2, :default => 0.0
  end

  add_index "rankings", ["primary_rank"], :name => "index_rankings_on_primary_rank"

  create_table "raw_item_xmls", :force => true do |t|
    t.integer  "item_id"
    t.text     "item_xml"
    t.datetime "created_at"
  end

  add_index "raw_item_xmls", ["item_id"], :name => "index_raw_item_xmls_on_item_id"

  create_table "reputation_data", :force => true do |t|
    t.integer "rep_id"
    t.string  "rep_key"
    t.string  "name"
    t.string  "parent_key"
    t.boolean "is_header",  :null => false
  end

  add_index "reputation_data", ["rep_id"], :name => "index_reputation_data_on_rep_id"

  create_table "reputations", :force => true do |t|
    t.integer "character_id"
    t.integer "rep_id"
    t.integer "amount"
  end

  add_index "reputations", ["character_id"], :name => "index_reputations_on_character_id"

  create_table "stats", :force => true do |t|
    t.integer "character_id"
    t.integer "group_id"
    t.string  "category"
    t.string  "stat_type"
    t.integer "rating"
    t.decimal "percent",      :precision => 6, :scale => 2
  end

  add_index "stats", ["character_id"], :name => "index_stats_on_character_id"

  create_table "talents", :force => true do |t|
    t.integer  "character_id"
    t.boolean  "active",                                                           :null => false
    t.string   "spec_role"
    t.integer  "group"
    t.integer  "sum_tree1"
    t.integer  "sum_tree2"
    t.integer  "sum_tree3"
    t.string   "compressed_data"
    t.integer  "unspent",                                       :default => 0
    t.integer  "average_ilvl",                                  :default => 0
    t.decimal  "equip_percent",   :precision => 3, :scale => 2, :default => 0.0
    t.decimal  "gem_percent",     :precision => 3, :scale => 2, :default => 0.0
    t.decimal  "enchant_percent", :precision => 3, :scale => 2, :default => 0.0
    t.boolean  "is_pvp",                                        :default => false, :null => false
    t.datetime "updated_at"
  end

  add_index "talents", ["character_id"], :name => "index_talents_on_character_id"

  create_table "titles", :force => true do |t|
    t.integer "title_id"
    t.string  "name"
    t.string  "location"
  end

  add_index "titles", ["title_id"], :name => "index_titles_on_title_id"

  create_table "users", :force => true do |t|
    t.string  "login"
    t.string  "email"
    t.string  "password_hash"
    t.string  "password_salt"
    t.string  "persistence_token"
    t.string  "perishable_token"
    t.string  "openid_identifier"
    t.integer "failed_login_count", :default => 0
    t.string  "last_login_ip"
    t.boolean "admin"
    t.boolean "mod"
  end

  add_index "users", ["login"], :name => "index_users_on_login"

end


text:
package org.apache.camel.component.mina;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.jupiter.api.Test;

public class MinaFileUdpTest extends BaseMinaTest {

    @Test
    public void testMinaRoute() throws Exception {
        MockEndpoint endpoint = getMockEndpoint("mock:results");
        endpoint.expectedMessageCount(1);
        endpoint.message(0).body().startsWith("Hello World");

        MockEndpoint.assertIsSatisfied(context);
    }

    @Override
    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {

            public void configure() {
                // lets setup a server
                fromF("mina:udp://localhost:%1$s?sync=false&textline=true", getPort()).to("mock:results");

                from("file:src/test/data?noop=true")
                        .toF("mina:udp://localhost:%1$s?sync=false&textline=true", getPort());
            }
        };
    }
}


text:
'use strict';

let AbstractGroupModel = require('./AbstractGroupModel');

const DETAILS = {
  id:           'HML004',
  manufacturer: 'Philips',
  name:         'Hue Phoenix Wall',
  type:         'Luminaire',
};

/**
 * Group model: HML004
 */
class HML004 extends AbstractGroupModel {
  /**
   * Constructor
   */
  constructor() {
    super(DETAILS);
  }
}

module.exports = HML004;