2 * Copyright (C) 2011 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef __EntryPoint__H__
17 #define __EntryPoint__H__
25 //---------------------------------------------------
27 typedef std::vector<Var> VarsArray;
32 virtual ~EntryPoint();
33 bool parse(unsigned int lc, const std::string & str);
34 void reset(); // reset the class to empty;
35 void print(FILE *fp = stdout, bool newline = true,
36 const std::string & name_suffix = std::string(""),
37 const std::string & name_prefix = std::string(""),
38 const std::string & ctx_param = std::string("")) const;
39 const std::string & name() const { return m_name; }
40 VarsArray & vars() { return m_vars; }
41 Var & retval() { return m_retval; }
42 Var * var(const std::string & name);
44 bool unsupported() const { return m_unsupported; }
45 void setUnsupported(bool state) { m_unsupported = state; }
46 bool customDecoder() { return m_customDecoder; }
47 void setCustomDecoder(bool state) { m_customDecoder = state; }
48 bool notApi() const { return m_notApi; }
49 void setNotApi(bool state) { m_notApi = state; }
50 bool flushOnEncode() const { return m_flushOnEncode; }
51 void setFlushOnEncode(bool state) { m_flushOnEncode = state; }
52 int setAttribute(const std::string &line, size_t lc);
55 enum { PR_RETVAL = 0, PR_NAME, PR_VARS, PR_DONE } prState;
64 void err(unsigned int lc, const char *msg) {
65 fprintf(stderr, "line %d: %s\n", lc, msg);