summaryrefslogtreecommitdiff
path: root/ace/Svc_Conf_Lexer.h
blob: 387e7b7611f210f62fb9c7e03d9f0dcfb33898cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// -*- C++ -*-

//=========================================================================
/**
 * @file Svc_Conf_Lexer.h
 *
 * $Id$
 *
 * This class is a hand-coded replacement for the lexer generated from
 * Svc_Conf.l that correctly supports Unicode.
 *
 * @author Chad Elliott <elliott_c@ociweb.com>
 */
//=========================================================================

#ifndef SVC_CONF_LEXER_H
#define SVC_CONF_LEXER_H

#include /**/ "ace/pre.h"
#include "ace/Svc_Conf.h"

#if (ACE_USES_CLASSIC_SVC_CONF == 1)
#include "ace/Encoding_Converter_Factory.h"

class ACE_Encoding_Converter;

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

/** This class lexes the classic ACE Service Configurator language.
 * The entry point is similar to what flex would generate.  However, it
 * is a static method in this class (which is really just name space).
 */
class ACE_Svc_Conf_Lexer
{
public:
  /// This is similar to the C function, ace_yylex, which a bison
  /// generated parser expects.  It returns information in the ace_yylval
  /// parameter and uses input stored in the param parameter.
  static int yylex (ACE_YYSTYPE* ace_yylval,
                    ACE_Svc_Conf_Param* param);

private:
  static size_t input(ACE_Svc_Conf_Param* param, char* buf, size_t max_size);

  static int scan (ACE_YYSTYPE* ace_yylval, ACE_Svc_Conf_Param* param);

#if defined (ACE_USES_WCHAR)
  static bool convert_to_utf8 (
                   ACE_Svc_Conf_Param* param,
                   size_t skip_bytes,
                   ACE_Encoding_Converter_Factory::Encoding_Hint hint);
  static bool convert_from_utf8 (ACE_Encoding_Converter* converter,
                                 const char* source,
                                 size_t source_size,
                                 ACE_TCHAR* target,
                                 size_t target_size,
                                 size_t& length);
  static ACE_Encoding_Converter_Factory::Encoding_Hint
                   locate_bom (char* source,
                               size_t source_size,
                               size_t& bytes_used);
#endif /* ACE_USES_WCHAR */
};

ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_USES_CLASSIC_SVC_CONF = 1 */

#include /**/ "ace/post.h"

#endif /* SVC_CONF_LEXER_H */