# Copyright (C) 2017 Bran Seals. All rights reserved.
# Created: 2017-06-05

print("== UML to CPP ==")
print("Create or modify C++ header and implementation files by plaintext UML.")
#print("Enter a UML filename: ") # file import currently disabled
# check if file isn't too bonkers
#uml = [] # pull UML into memory as string list, 1 line per element
# check if file is properly formatted

classList = [] # list of classes that will be created, along with members
noteList = [] # if weird things happen, this list will show potential errors
              # will be displayed after files are created for user info

# DECISION: create classList or just iterate through uml list?

# for each in uml list:
    # get class name
    # while } not reached:
        # if +, put into hppPub
        # if -, put into hppPriv
        # if neither, put into hppPriv and add message to noteList
    # use these to create UmlClass object and append to classList

# for each in classList:
    # create name.hpp file and write using hpp list
    # create name.cpp file and write using cpp list
    # remove object from classList?

class UmlClass:
    def __init__(self, className, hppPub, hppPriv):
        self.name = className
        self.hppPublic = list(hppPub)
        self.hppPrivate = list(hppPriv)
        # buildHpp()
        # buildCpp()

    functions = [] # list of functions used to build cpp file
    hpp = [] # will contain final hpp template, built from hppPub, hppPriv
    cpp = [] # same as hpp, but with implementation file

    #def isFunction(): # looks for function syntax
                       # used when creating cpp file from hpp list

    #def checkForLibs(): # include libraries for data types that need them

    #def formatFunc(): # formats function from hpp to cpp style
                       # also takes into account return type and variable names

    #def buildHpp(): # builds hpp using information

    #def buildCpp(): # builds cpp using information
@@ -276,17 +276,16 @@
 bonkers%0A
-#
 uml = %5B%5D
@@ -385,82 +385,29 @@
 ted%0A
-%0AclassList = %5B%5D # list of classes that will be created, along with members
+# create blank object
 %0Anot
@@ -559,366 +559,293 @@
 %0A%0A# 
-DECISION: create classList or just iterate through uml list?%0A%0A# for each in uml list:%0A    # get class name%0A    # while %7D not reached:%0A        # if +, put into hppPub%0A        # if -, put into hppPriv%0A        # if neither, put into hppPriv and add message to noteList%0A    # use these to create UmlClass object and append to classList%0A%0A# for each in classList:%0A
+for each in uml list:%0A    # if first 4 = %22class%22 and ends in %7B:%0A        # create new object with className%0A    # if +, obj.addToPublic(uml%5Bcurrent%5D)%0A    # if -, obj.addToPrivate(uml%5Bcurrent%5D)%0A    # if neither, obj.addToPrivate(uml%5Bcurrent%5D) and add message to noteList%0A    # if %7D:%0A    
     
@@ -888,24 +888,28 @@
 ng hpp list%0A
+    
     # create
@@ -951,44 +951,8 @@
 list
-%0A    # remove object from classList?
 %0A%0Acl
@@ -1001,25 +1001,8 @@
 Name
-, hppPub, hppPriv
 ):%0A 
@@ -1047,182 +1047,199 @@
 elf.
-hppPublic = list(hppPub)%0A        self.hppPrivate = list(hppPriv)%0A        # buildHpp()%0A        # buildCpp()%0A%0A    functions = %5B%5D # list of functions used to build cpp file%0A    
+cpp = %5B%5D # will contain final implementation file%0A        self.functions = %5B%5D # list of functions used to build cpp file%0A        self.hppPrivate = %5B%5D%0A        self.hppPublic = %5B%5D%0A        self.
 hpp 
@@ -1309,64 +1309,254 @@
 riv%0A
+%0A
     
-cpp = %5B%5D # same as hpp, but with implementation file
+def addToPublic(self, pubMember): # adds given string to public scope list%0A        self.hppPublic.append(pubMember)%0A%0A    def addToPrivate(self, privMember): # adds given string to private scope list%0A        self.hppPrivate.append(privMember)
 %0A%0A  
@@ -1977,28 +1977,117 @@
 builds cpp using information
+%0A%0A    #def build(): # overall build file function%0A        #buildHpp()%0A        #buildCpp()

Reduce number of lists in pseudocode