1
0
Fork 0
arangodb/QL/formatter.h

137 lines
4.4 KiB
C

////////////////////////////////////////////////////////////////////////////////
/// @brief AST dump functions
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Copyright 2012, triagens GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#ifndef TRIAGENS_DURHAM_QL_FORMATTER
#define TRIAGENS_DURHAM_QL_FORMATTER
#include <string.h>
#include <stdio.h>
#include <inttypes.h>
#include "QL/ast-node.h"
#ifdef __cplusplus
extern "C" {
#endif
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup QL
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief Formatter context to keep track of current indentation level
////////////////////////////////////////////////////////////////////////////////
typedef struct QL_formatter_s {
unsigned int indentLevel;
}
QL_formatter_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief Increase indentation
////////////////////////////////////////////////////////////////////////////////
void QLFormatterIndentationInc (QL_formatter_t *);
////////////////////////////////////////////////////////////////////////////////
/// @brief Decrease indentation
////////////////////////////////////////////////////////////////////////////////
void QLFormatterIndentationDec (QL_formatter_t *);
////////////////////////////////////////////////////////////////////////////////
/// @brief Print current indentation
////////////////////////////////////////////////////////////////////////////////
void QLFormatterPrintIndentation (QL_formatter_t *);
////////////////////////////////////////////////////////////////////////////////
/// @brief Print start of a block
////////////////////////////////////////////////////////////////////////////////
void QLFormatterPrintBlockStart (QL_formatter_t *, const char *);
////////////////////////////////////////////////////////////////////////////////
/// @brief Print end of a block
////////////////////////////////////////////////////////////////////////////////
void QLFormatterPrintBlockEnd (QL_formatter_t *, const char *);
////////////////////////////////////////////////////////////////////////////////
/// @brief Print an indented int value
////////////////////////////////////////////////////////////////////////////////
void QLFormatterPrintInt (QL_formatter_t *, const char *, uint64_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief Print an indented double value
////////////////////////////////////////////////////////////////////////////////
void QLFormatterPrintDouble (QL_formatter_t *, const char *, double);
////////////////////////////////////////////////////////////////////////////////
/// @brief Print an indented string value
////////////////////////////////////////////////////////////////////////////////
void QLFormatterPrintStr (QL_formatter_t *, const char *, const char *);
////////////////////////////////////////////////////////////////////////////////
/// @brief Recursively dump an AST
////////////////////////////////////////////////////////////////////////////////
void QLFormatterDump (QL_ast_node_t *,QL_formatter_t *, const int);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif
#endif
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
// End: