Skip to content

Commit

Permalink
Fix #25 (and attempt to fix readthedocs build)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault committed Apr 17, 2023
1 parent 0363cb9 commit d305bcc
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 29 deletions.
32 changes: 18 additions & 14 deletions doc/source/org-doc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ to the `sec-module-class-member`_.
super().__init__(class_variable, member_scope)
self._type = _cleanup_type(class_variable['type'])
if class_variable.get('array', 0):
self._type += '[]'
def get_type(self):
"""Variable type accessor
Expand Down Expand Up @@ -2298,15 +2301,17 @@ the representation of variables.
.. table:: List of test segments and corresponding PlantUML strings.
:name: tbl-unittest-class_var

+---------------------------------------------+-------------------+
| C++ | plantuml |
+=============================================+===================+
| "class Test {\npublic:\nint member; };" | "+member : int" |
+---------------------------------------------+-------------------+
| "class Test {\nprivate:\nint \* member; };" | "-member : int\*" |
+---------------------------------------------+-------------------+
| "class Test {\nprotected:\nint &member; };" | "#member : int&" |
+---------------------------------------------+-------------------+
+------------------------------------------------+-------------------+
| C++ | plantuml |
+================================================+===================+
| "class Test {\npublic:\nint member; };" | "+member : int" |
+------------------------------------------------+-------------------+
| "class Test {\nprivate:\nint \* member; };" | "-member : int\*" |
+------------------------------------------------+-------------------+
| "class Test {\nprotected:\nint &member; };" | "#member : int&" |
+------------------------------------------------+-------------------+
| "class Test {\nprotected:\nint member[10]; };" | "#member : int[]" |
+------------------------------------------------+-------------------+


.. code:: python
Expand Down Expand Up @@ -2705,7 +2710,7 @@ The comparison takes into account the white space, indentation, etc.


class anon_union_1 {
+vec : float
+vec : float[]
}


Expand Down Expand Up @@ -2898,7 +2903,7 @@ The comparison takes into account the white space, indentation, etc.


class anon_union_1 {
+vec : float
+vec : float[]
}


Expand Down Expand Up @@ -3390,14 +3395,13 @@ options. Most of it is taken from `this post <https://hynek.me/articles/sharing
.. code:: python
:name: py-setup-import
# %% Imports
import os
import sys
import re
import codecs
from setuptools import setup, find_namespace_packages, Command
from setuptools import setup, find_packages, Command
try:
import sphinx
import sphinx.ext.apidoc
Expand All @@ -3418,7 +3422,7 @@ The non-boilerplate part of the ``setup.py`` file defines the package informatio
###################################################################
NAME = "hpp2plantuml"
PACKAGES = find_namespace_packages(where="src")
PACKAGES = find_packages(where="src")
META_PATH = os.path.join("src", NAME, "__init__.py")
KEYWORDS = ["class"]
CLASSIFIERS = [
Expand Down
23 changes: 13 additions & 10 deletions hpp2plantuml.org
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,9 @@ class ClassVariable(ClassMember):
super().__init__(class_variable, member_scope)

self._type = _cleanup_type(class_variable['type'])
if class_variable.get('array', 0):
self._type += '[]'


def get_type(self):
"""Variable type accessor
Expand Down Expand Up @@ -2268,11 +2271,12 @@ the representation of variables.

#+NAME: tbl-unittest-class_var
#+CAPTION: List of test segments and corresponding PlantUML strings.
| C++ | plantuml |
|---------------------------------------------+------------------|
| "class Test {\npublic:\nint member; };" | "+member : int" |
| "class Test {\nprivate:\nint * member; };" | "-member : int*" |
| "class Test {\nprotected:\nint &member; };" | "#member : int&" |
| C++ | plantuml |
|------------------------------------------------+-------------------|
| "class Test {\npublic:\nint member; };" | "+member : int" |
| "class Test {\nprivate:\nint * member; };" | "-member : int*" |
| "class Test {\nprotected:\nint &member; };" | "#member : int&" |
| "class Test {\nprotected:\nint member[10]; };" | "#member : int[]" |


#+NAME: test-unit-class_var
Expand Down Expand Up @@ -2641,7 +2645,7 @@ class anon_union_1::anon_struct_2 {


class anon_union_1 {
+vec : float
+vec : float[]
}


Expand Down Expand Up @@ -2833,7 +2837,7 @@ class anon_union_1::anon_struct_2 {


class anon_union_1 {
+vec : float
+vec : float[]
}


Expand Down Expand Up @@ -3223,14 +3227,13 @@ options. Most of it is taken from [[https://hynek.me/articles/sharing-your-labo

#+NAME: py-setup-import
#+BEGIN_SRC python

# %% Imports
import os
import sys
import re
import codecs

from setuptools import setup, find_namespace_packages, Command
from setuptools import setup, find_packages, Command
try:
import sphinx
import sphinx.ext.apidoc
Expand All @@ -3250,7 +3253,7 @@ The non-boilerplate part of the =setup.py= file defines the package information.
###################################################################

NAME = "hpp2plantuml"
PACKAGES = find_namespace_packages(where="src")
PACKAGES = find_packages(where="src")
META_PATH = os.path.join("src", NAME, "__init__.py")
KEYWORDS = ["class"]
CLASSIFIERS = [
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re
import codecs

from setuptools import setup, find_namespace_packages, Command
from setuptools import setup, find_packages, Command
try:
import sphinx
import sphinx.ext.apidoc
Expand All @@ -17,7 +17,7 @@
###################################################################

NAME = "hpp2plantuml"
PACKAGES = find_namespace_packages(where="src")
PACKAGES = find_packages(where="src")
META_PATH = os.path.join("src", NAME, "__init__.py")
KEYWORDS = ["class"]
CLASSIFIERS = [
Expand Down
3 changes: 3 additions & 0 deletions src/hpp2plantuml/hpp2plantuml.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ def __init__(self, class_variable, member_scope='private'):
super().__init__(class_variable, member_scope)

self._type = _cleanup_type(class_variable['type'])
if class_variable.get('array', 0):
self._type += '[]'


def get_type(self):
"""Variable type accessor
Expand Down
2 changes: 1 addition & 1 deletion tests/simple_classes.puml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class anon_union_1::anon_struct_2 {


class anon_union_1 {
+vec : float
+vec : float[]
}


Expand Down
2 changes: 1 addition & 1 deletion tests/simple_classes_nodep.puml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class anon_union_1::anon_struct_2 {


class anon_union_1 {
+vec : float
+vec : float[]
}


Expand Down
4 changes: 3 additions & 1 deletion tests/test_hpp2plantuml.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def test_comparison_keys(self):
private:
int * member; };""", "-member : int*"], ["""class Test {
protected:
int &member; };""", "#member : int&"]]
int &member; };""", "#member : int&"], ["""class Test {
protected:
int member[10]; };""", "#member : int[]"]]
# %% Test class variables


Expand Down

0 comments on commit d305bcc

Please sign in to comment.