Sha256: 9cda3240cf68c2889a51efd437fb4bf7beb3ca6675204db83c39b3326c1a4f2c

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

# Copyright 2019-present, GraphQL Foundation
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from casing import camel, title
from license import C_LICENSE_COMMENT

class Printer(object):
  def __init__(self):
    pass

  def start_file(self):
    print C_LICENSE_COMMENT + '''/** @generated */

#pragma once

#include "Ast.h"

namespace facebook {
namespace graphql {
namespace ast {
namespace visitor {

class AstVisitor {
public:
  virtual ~AstVisitor() {}
'''

  def end_file(self):
    print '};' # end AstVisitor
    print
    print '}'
    print '}'
    print '}'
    print '}'

  def start_type(self, name):
    titleName = title(name)
    camelName = camel(titleName)
    print '  virtual bool visit%s(const %s &%s) { return true; }' % (
      titleName,
      titleName,
      camelName)
    print '  virtual void endVisit%s(const %s &%s) { }' % (
      titleName,
      titleName,
      camelName)
    print

  def end_type(self, name):
    pass

  def field(self, type, name, nullable, plural):
    pass

  def start_union(self, name):
    pass

  def union_option(self, option):
    pass

  def end_union(self, name):
    pass

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails-graphql-0.2.1 ext/libgraphqlparser/ast/cxx_visitor.py
rails-graphql-0.2.0 ext/libgraphqlparser/ast/cxx_visitor.py
rails-graphql-0.1.3 ext/libgraphqlparser/ast/cxx_visitor.py
rails-graphql-0.1.2 ext/libgraphqlparser/ast/cxx_visitor.py
rails-graphql-0.1.1 ext/libgraphqlparser/ast/cxx_visitor.py
rails-graphql-0.1.0 ext/libgraphqlparser/ast/cxx_visitor.py