Commit 759f089f authored by François Grisez's avatar François Grisez

Multi-language HTML documentation generation

parent 750146f8
......@@ -53,6 +53,7 @@ option(ENABLE_NLS "Build with internationalisation support" YES)
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
option(ENABLE_ROOTCA_DOWNLOAD "Download rootca.pem at build time." YES)
option(ENABLE_SOCI_STORAGE "Turn on compilation soci storage, for messages, contacts, history" YES)
option(ENABLE_SPHINX_DOC "Turn on the generation of the multi-language API documentation based on Sphinx. ENABLE_DOC must be set to YES in order that option be taken into account." NO)
option(ENABLE_SQLITE_STORAGE "Turn on compilation sqlite storage, for messages, contacts, history" YES)
option(ENABLE_STRICT "Build with strict compile options." YES)
option(ENABLE_TOOLS "Turn on or off compilation of tools." YES)
......@@ -191,7 +192,7 @@ if(ENABLE_LIME)
endif()
set(HAVE_LIME 1)
endif()
if(ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER)
if(ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_DOC)
find_package(PythonInterp REQUIRED)
endif()
......
......@@ -21,22 +21,23 @@
############################################################################
add_subdirectory(doxygen)
add_subdirectory(sphinx)
if(ENABLE_JAVADOC)
find_package(Java REQUIRED)
set(JAVADOC_PACKAGES "org.linphone.core org.linphone.mediastream")
set(JAVADOC_CLASSPATHS
"${PROJECT_SOURCE_DIR}/java/common"
"${PROJECT_SOURCE_DIR}/java/j2se"
"${PROJECT_SOURCE_DIR}/mediastreamer2/java/src"
)
string(REPLACE ";" ":" JAVADOC_CLASSPATHS "${JAVADOC_CLASSPATHS}")
set(JAVADOC_TITLE "Linphone SDK ${PROJECT_VERSION} reference documentation")
set(JAVADOC_JAVA_REFERENCE "http://docs.oracle.com/javase/8/docs/api/")
set(JAVADOC_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc/java")
set(JAVADOC_LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/javadoc.log")
configure_file("generate_javadoc.sh.in" "generate_javadoc.sh" @ONLY)
add_custom_target(javadoc ALL
COMMAND "${CMAKE_CURRENT_BINARY_DIR}/generate_javadoc.sh"
)
find_package(Java REQUIRED)
set(JAVADOC_PACKAGES "org.linphone.core org.linphone.mediastream")
set(JAVADOC_CLASSPATHS
"${PROJECT_SOURCE_DIR}/java/common"
"${PROJECT_SOURCE_DIR}/java/j2se"
"${PROJECT_SOURCE_DIR}/mediastreamer2/java/src"
)
string(REPLACE ";" ":" JAVADOC_CLASSPATHS "${JAVADOC_CLASSPATHS}")
set(JAVADOC_TITLE "Linphone SDK ${PROJECT_VERSION} reference documentation")
set(JAVADOC_JAVA_REFERENCE "http://docs.oracle.com/javase/8/docs/api/")
set(JAVADOC_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc/java")
set(JAVADOC_LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/javadoc.log")
configure_file("generate_javadoc.sh.in" "generate_javadoc.sh" @ONLY)
add_custom_target(javadoc ALL
COMMAND "${CMAKE_CURRENT_BINARY_DIR}/generate_javadoc.sh"
)
endif()
......@@ -30,16 +30,18 @@ if (ENABLE_DOC OR ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER)
${CMAKE_CURRENT_SOURCE_DIR}/doxygen.dox
${LINPHONE_HEADER_FILES}
)
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/index.html" "${CMAKE_CURRENT_BINARY_DIR}/xml/index.xml"
set(XML_DIR "${CMAKE_CURRENT_BINARY_DIR}/xml")
set(LINPHONE_DOXYGEN_XML_DIR ${XML_DIR} PARENT_SCOPE)
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/index.html" "${XML_DIR}/index.xml"
COMMAND ${CMAKE_COMMAND} -E remove -f html/* xml/*
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
DEPENDS ${DOC_INPUT_FILES}
)
add_custom_target(linphone-doc ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/index.html" "${CMAKE_CURRENT_BINARY_DIR}/xml/index.xml")
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" "${CMAKE_CURRENT_BINARY_DIR}/xml"
add_custom_target(linphone-doc ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/index.html" "${XML_DIR}/index.xml")
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" "${XML_DIR}"
DESTINATION "${CMAKE_INSTALL_DATADIR}/doc/linphone-${LINPHONE_VERSION}")
else()
if (ENABLE_CXX_WRAPPER)
if (ENABLE_CXX_WRAPPER)
message(FATAL_ERROR "The dot program is needed to generate the linphone documentation. You can get it from http://www.graphviz.org/.")
else()
message(WARNING "The dot program is needed to generate the linphone documentation. You can get it from http://www.graphviz.org/.")
......
############################################################################
# CMakeLists.txt
# Copyright (C) 2017 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
############################################################################
if (ENABLE_DOC AND ENABLE_SPHINX_DOC)
set(GENERATED_LANGUAGES c cpp csharp)
set(DOCUMENTATION_DIRS )
set(GENERATED_SPHINX_SOURCES )
foreach(LANGUAGE_ ${GENERATED_LANGUAGES})
set(DOCUMENTATION_DIR ${CMAKE_CURRENT_BINARY_DIR}/source/${LANGUAGE_})
list(APPEND DOCUMENTATION_DIRS ${DOCUMENTATION_DIR})
list(APPEND GENERATED_SPHINX_SOURCES ${DOCUMENTATION_DIR}/index.rst)
endforeach(LANGUAGE_)
set(PYTHON_SCRIPTS gendoc.py
${linphone_SOURCE_DIR}/tools/abstractapi.py
${linphone_SOURCE_DIR}/tools/genapixml.py
${linphone_SOURCE_DIR}/tools/metadoc.py
${linphone_SOURCE_DIR}/tools/metaname.py
)
set(MUSTACHE_TEMPLATES class_page.mustache
enums_page.mustache
index_page.mustache
)
configure_file(conf.py.in source/conf.py)
configure_file(source/index.rst source/index.rst COPYONLY)
add_custom_command(OUTPUT ${GENERATED_SPHINX_SOURCES}
COMMAND ${CMAKE_COMMAND} -E remove -f ${DOCUMENTATION_DIRS}
COMMAND ${PYTHON_EXECUTABLE} '${CMAKE_CURRENT_SOURCE_DIR}/gendoc.py' '${LINPHONE_DOXYGEN_XML_DIR}' -o 'source'
DEPENDS ${PYTHON_SCRIPTS}
${MUSTACHE_TEMPLATES}
${LINPHONE_DOXYGEN_XML_DIR}/index.xml
linphone-doc
)
add_custom_command(OUTPUT build/html/index.html
COMMAND ${CMAKE_COMMAND} -E remove_directory build
COMMAND ${PYTHON_EXECUTABLE} -msphinx -M html 'source' 'build'
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/source/conf.py
${CMAKE_CURRENT_BINARY_DIR}/source/index.rst
${GENERATED_SPHINX_SOURCES}
)
add_custom_target(sphinx-doc ALL DEPENDS build/html/index.html)
endif()
{{#make_chapter}}{{{className}}} class{{/make_chapter}}
.. {{#write_declarator}}class{{/write_declarator}}:: {{{fullClassName}}}
{{#briefDoc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/briefDoc}}
{{#detailedDoc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/detailedDoc}}
{{{selector}}}
Summary
=======
{{#hasProperties}}
Properties
----------
{{{propertiesSummary}}}
{{/hasProperties}}
{{#hasMethods}}
Methods
-------
{{{instanceMethodsSummary}}}
{{/hasMethods}}
{{#hasClassMethods}}
Class methods
-------------
{{{classMethodsSummary}}}
{{/hasClassMethods}}
Detailed descriptions
=====================
{{#hasProperties}}
Properties
----------
{{#properties}}
{{{title}}}
{{#hasNamespaceDeclarator}}
.. {{#write_declarator}}namespace{{/write_declarator}}:: {{{fullClassName}}}
{{/hasNamespaceDeclarator}}
{{#getter}}
.. {{#write_declarator}}method{{/write_declarator}}:: {{{prototype}}}
{{#briefDoc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/briefDoc}}
{{#detailedDoc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/detailedDoc}}
{{{selector}}}
{{/getter}}
{{#setter}}
.. {{#write_declarator}}method{{/write_declarator}}:: {{{prototype}}}
{{#briefDoc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/briefDoc}}
{{#detailedDoc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/detailedDoc}}
{{{selector}}}
{{/setter}}
{{/properties}}
{{/hasProperties}}
{{#hasMethods}}
Public methods
--------------
{{#hasNamespaceDeclarator}}
.. {{#write_declarator}}namespace{{/write_declarator}}:: {{{fullClassName}}}
{{/hasNamespaceDeclarator}}
{{#methods}}
.. {{#write_declarator}}method{{/write_declarator}}:: {{{prototype}}}
{{#briefDoc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/briefDoc}}
{{#detailedDoc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/detailedDoc}}
{{{selector}}}
{{/methods}}
{{/hasMethods}}
{{#hasClassMethods}}
Class methods
-------------
{{#hasNamespaceDeclarator}}
.. {{#write_declarator}}namespace{{/write_declarator}}:: {{{fullClassName}}}
{{/hasNamespaceDeclarator}}
{{#classMethods}}
.. {{#write_declarator}}method{{/write_declarator}}:: static {{{prototype}}}
{{#briefDoc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/briefDoc}}
{{#detailedDoc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/detailedDoc}}
{{{selector}}}
{{/classMethods}}
{{/hasClassMethods}}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Linphone API documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 19 11:58:21 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx_csharp.csharp']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'Linphone Core API'
copyright = '2017, Belledonne Communications SARL'
author = 'Belledonne Communications SARL'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '${LINPHONE_MAJOR_VERSION}.${LINPHONE_MINOR_VERSION}'
# The full version, including alpha/beta/rc tags.
release = '${LINPHONE_VERSION}'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#html_theme = 'alabaster'
html_theme = 'classic'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'LinphoneAPIdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'LinphoneAPI.tex', 'Linphone API Documentation',
'Belledonne Communications SARL', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'linphoneapi', 'Linphone Core API Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'LinphoneCoreAPI', 'Linphone Core API Documentation',
author, 'LinphoneCoreAPI', 'One line description of project.',
'Miscellaneous'),
]
{{#enums}}
{{{sectionName}}}
.. {{#write_declarator}}enum{{/write_declarator}}:: {{{fullName}}}
{{#briefDesc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/briefDesc}}
{{{selector}}}
{{#hasNamespaceDeclarator}}
.. {{#write_declarator}}namespace{{/write_declarator}}:: {{{namespace}}}
{{/hasNamespaceDeclarator}}
{{#enumerators}}
.. {{#write_declarator}}enumerator{{/write_declarator}}:: {{{name}}}{{#value}} = {{{value}}}{{/value}}
{{#briefDesc}}
{{#lines}}
{{{line}}}
{{/lines}}
{{/briefDesc}}
{{{selector}}}
{{/enumerators}}
{{/enums}}
This diff is collapsed.
{{#make_section}}{{{language}}} API{{/make_section}}
Index of classes
----------------
.. toctree::
:maxdepth: 1
{{#tocEntries}}
{{{entryName}}}
{{/tocEntries}}
Index of enums
--------------
.. toctree::
:maxdepth 1
enums.rst
.. Linphone API documentation master file, created by
sphinx-quickstart on Mon Jun 19 11:58:21 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Linphone API's documentation!
========================================
.. toctree::
:maxdepth: 1
:caption: Contents:
c/index.rst
cpp/index.rst
csharp/index.rst
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
This diff is collapsed.
......@@ -33,6 +33,7 @@ class CObject:
self.detailedDescription = None
self.deprecated = False
self.briefDoc = None
self.detailedDoc = None
class CEnumValue(CObject):
......@@ -339,6 +340,7 @@ class Project:
if st.associatedTypedef == td:
cclass = CClass(st)
cclass.briefDoc = td.briefDoc
cclass.detailedDoc = td.detailedDoc
self.add(cclass)
break
elif ('Linphone' + td.definition) == td.name:
......@@ -346,6 +348,7 @@ class Project:
st.associatedTypedef = td
cclass = CClass(st)
cclass.briefDoc = td.briefDoc
cclass.detailedDoc = td.detailedDoc
self.add(st)
self.add(cclass)
# Sort classes by length of name (longest first), so that methods are put in the right class
......@@ -389,6 +392,7 @@ class Project:
ev.deprecated = True
ev.briefDescription = ''.join(node.find('./briefdescription').itertext()).strip()
ev.briefDoc = self.docparser.parse_description(node.find('./briefdescription'))
ev.detailedDoc = self.docparser.parse_description(node.find('./detaileddescription'))
ev.detailedDescription = self.__cleanDescription(node.find('./detaileddescription'))
return ev
......@@ -401,6 +405,7 @@ class Project:
e.deprecated = True
e.briefDescription = ''.join(node.find('./briefdescription').itertext()).strip()
e.briefDoc = self.docparser.parse_description(node.find('./briefdescription'))
e.detailedDoc = self.docparser.parse_description(node.find('./detaileddescription'))
e.detailedDescription = self.__cleanDescription(node.find('./detaileddescription'))
enumvalues = node.findall("enumvalue[@prot='public']")
for enumvalue in enumvalues:
......@@ -424,6 +429,7 @@ class Project:
sm.deprecated = True
sm.briefDescription = ''.join(node.find('./briefdescription').itertext()).strip()
sm.briefDoc = self.docparser.parse_description(node.find('./briefdescription'))
sm.detailedDoc = self.docparser.parse_description(node.find('./detaileddescription'))
sm.detailedDescription = self.__cleanDescription(node.find('./detaileddescription'))
return sm
......@@ -434,6 +440,7 @@ class Project:
s.deprecated = True
s.briefDescription = ''.join(node.find('./briefdescription').itertext()).strip()
s.briefDoc = self.docparser.parse_description(node.find('./briefdescription'))
s.detailedDoc = self.docparser.parse_description(node.find('./detaileddescription'))
s.detailedDescription = self.__cleanDescription(node.find('./detaileddescription'))
structmembers = node.findall("sectiondef/memberdef[@kind='variable'][@prot='public']")
for structmember in structmembers:
......@@ -503,6 +510,7 @@ class Project:
f.deprecated = True
f.briefDescription = ''.join(node.find('./briefdescription').itertext()).strip()
f.briefDoc = self.docparser.parse_description(node.find('./briefdescription'))
f.detailedDoc = self.docparser.parse_description(node.find('./detaileddescription'))
f.detailedDescription = self.__cleanDescription(node.find('./detaileddescription'))
return f
else:
......@@ -515,6 +523,7 @@ class Project:
td.deprecated = True
td.briefDescription = ''.join(node.find('./briefdescription').itertext()).strip()
td.briefDoc = self.docparser.parse_description(node.find('./briefdescription'))
td.detailedDoc = self.docparser.parse_description(node.find('./detaileddescription'))
td.detailedDescription = self.__cleanDescription(node.find('./detaileddescription'))
return td
return None
......@@ -531,6 +540,11 @@ class Project:
internal = node.find("./detaileddescription/internal")
if internal is not None:
return None
# The doc must be parsed here since the XML tree is to be modified in below code
briefDoc = self.docparser.parse_description(node.find('./briefdescription'))
detailedDoc = self.docparser.parse_description(node.find('./detaileddescription'))
missingDocWarning = ''
name = node.find('./name').text
t = ''.join(node.find('./type').itertext())
......@@ -574,10 +588,11 @@ class Project:
if deprecatedNode is not None:
f.deprecated = True
f.briefDescription = ''.join(node.find('./briefdescription').itertext()).strip()
f.briefDoc = self.docparser.parse_description(node.find('./briefdescription'))
f.detailedDescription = self.__cleanDescription(node.find('./detaileddescription'))
if f.briefDescription == '' and ''.join(f.detailedDescription.itertext()).strip() == '':
return None
f.briefDoc = briefDoc
f.detailedDoc = detailedDoc
locationNode = node.find('./location')
if locationNode is not None:
f.location = locationNode.get('file')
......
This diff is collapsed.
# Copyright (C) 2017 Belledonne Communications SARL
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import re
class Name(object):
camelCaseParsingRegex = re.compile('[A-Z][a-z0-9]*')
lowerCamelCaseSplitingRegex = re.compile('([a-z][a-z0-9]*)([A-Z][a-z0-9]*)')
def __init__(self):
self.words = []
self.prev = None
def __eq__(self, other):
return (other is not None and self.words == other.words) and (self.prev == other.prev)
def __lt__(self, other):
return self.to_camel_case() < other.to_camel_case()
def copy(self):
nameType = type(self)
name = nameType()
name.words = list(self.words)
name.prev = None if self.prev is None else self.prev.copy()
return name
def delete_prefix(self, prefix):
it = self
_next = None
while it is not None and it.words != prefix.words:
_next = it
it = it.prev
if it is None or it != prefix:
raise Error('no common prefix')
elif _next is not None:
_next.prev = None
def _set_namespace(self, namespace):
self.prev = namespace
if self.prev is not None:
prefix = namespace.to_word_list()
i = 0
while i<len(self.words) and i<len(prefix) and self.words[i] == prefix[i]:
i += 1
if i == len(self.words):
raise Error('name equal to namespace \'{0}\'', self.words)
else:
self.words = self.words[i:]
def _lower_all_words(self):
i = 0
while i<len(self.words):
self.words[i] = self.words[i].lower()
i += 1
def from_snake_case(self, name, namespace=None):
self.words = name.split('_')
Name._set_namespace(self, namespace)
def from_camel_case(self, name, islowercased=False, namespace=None):
if not islowercased:
self.words = Name.camelCaseParsingRegex.findall(name)
else:
match = Name.lowerCamelCaseSplitingRegex.match(name)
self.words = [match.group(1)]
self.words += Name.camelCaseParsingRegex.findall(match.group(2))
Name._lower_all_words(self)
Name._set_namespace(self, namespace)
def to_snake_case(self, fullName=False, upper=False):
if self.prev is None or not fullName:
res = '_'.join(self.words)
if upper:
res = res.upper()
return res
else:
return Name.to_snake_case(self.prev, fullName=True, upper=upper) + '_' + Name.to_snake_case(self, upper=upper)
def to_camel_case(self, lower=False, fullName=False):
if self.prev is None or not fullName:
res = ''
for elem in self.words:
if elem is self.words[0] and lower:
res += elem