Skip to content

guided-units-humans/cpp_csv_handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Corb's c++ csv file handler


Summary

sub project of the animal crossing project to handle csv files using raylib and raygui

Screenshot as at 22/01/23 08:36AM

show / hide screenshot showing current example of the project UI

Useful to user

show / hide
  • ===== ===== ===== ===== =====
  • Required folders (to get the project to work):
    • ~/build/
    • ~/external/
    • ~/resources/
  • ----- ----- ----- ----- -----
  • Required sub projects:
    • ~/external/raygui-3.2 (source)
    • ~/external/raylib-4.2.0 (source)
  • ----- ----- ----- ----- -----
  • Repository currently setup for environment (other environments untested):
    • Macbook pro 15in. --- [2019]
    • macOS Big Sur --- [11.7.2]
    • VS Code --- [1.74.3]
    • cpptools extension --- [1.13.9]
    • ***Plans to increase useability on other platforms is hindered by my current skill level using cmake***
  • ----- ----- ----- ----- -----
  • Notes:
    • Currently this project's cmake does not auto fetch raylib/raygui content
    • As at 22/1/23 07:59AM, raygui functionality isn't used except for CorbGrid's draw() to make the outline/background and the code from CorbCell's draw() can be used in its place
  • ----- ----- ----- ----- -----
  • ===== ===== ===== ===== =====

Notices / Changes

show / hide
  • [from source project README.md relating to this code]
    • [ show / hide ]
      • [24/12/22] ---> ported readme from cpp_newer_modeller (private repo at the time)
        show / hide
        • ===== ===== ===== ===== =====
        • [12:27am] ---> started working on cmake handling of raylib and raygui
        • [03:25am] ---> mygiveupjarjar.gif no more pre-fetching the packages for now, just download them myself yemstve, we goto the store first bc need a break or brain will break
        • [04:55am] ---> we got it working with cmake and provided libraries
        • ===== ===== ===== ===== =====
      • [25/12/22] to [28/12/22][07:03pm] ---> CSV file reader handle added which took some effort and planning but was constructed really haphazardly so maybe need revisiting
      • [28/12/22] ---> additional changes after finishing CSV file reader
        show / hide
        • ===== ===== ===== ===== =====
        • [07:03pm] ---> added include statement for CSVRead.hpp
        • [07:03pm] ---> will need a list of the CSV files and then can begin working on something to search them for similarities
        • ===== ===== ===== ===== =====
      • [30/12/22] ---> setting up data handles
        show / hide
        • ===== ===== ===== ===== =====
        • [07:34pm] ---> added in stubs for data handle and ideas as comments
        • ===== ===== ===== ===== =====
      • [31/12/22] ---> we making a spreadsheet thinger
        show / hide
        • ===== ===== ===== ===== =====
        • [01:12pm] ---> we start the structure i guess
        • [03:10pm] ---> eyes glazed over from this tutorial, so stopped trying to library in cmake for now, just hardcoding it:
        • ----- ----- ----- ----- -----
        • [04:17pm] ---> added in some stubs for CorbSheet, which will have:
          • CorbCell: holds our drawn content for values
          • CorbGrid: holds our CorbCell instances
          • CorbSheet: project specialised Client class
        • [04:19pm] ---> still need to add in code for handling csv data and putting it into our grid
        • ===== ===== ===== ===== =====
      • [01/01/23] ---> cleaning up CSVRead errors
        show / hide
        • ===== ===== ===== ===== =====
        • [12:07pm] ---> fixed up issue with signature of CSV::getTokenList not having correct parameters for both definition and declaration
        • [12:07pm] ---> moved static methods of CSV::Handler to namespace scope
        • [12:07pm] ---> fixed issue with CSV::getFilestreamLines not keeping the reference of the ifstream parameter by changing to pass by address
        • [12:07pm] ---> changed CSV::getTokenList to have currChar as string, and cleaned up the conditionals relating to it
        • ----- ----- ----- ----- -----
        • [01:03pm] ---> completed Main.cpp::getTableObjects
        • [01:07pm] ---> began work on Main.cpp::getTableHeaderLists
        • ----- ----- ----- ----- -----
        • [01:20pm] ---> updated CSV::Handler::get to use col/row instead of x/y
        • [01:23pm] ---> finished Main.cpp::getTableHeaderLists
        • ----- ----- ----- ----- -----
        • [01:35pm] ---> added in Main.cpp::listHasItem for searching a list for an exact match to a string
        • [01:42pm] ---> completed definition of Main.cpp::getUniqueFieldsList
        • [02:05pm] ---> completed definition of Main.cpp::getTablesContainingFieldList
        • ----- ----- ----- ----- -----
        • [02:54pm] ---> completed construction of code including testing code in Main.cpp::main
        • [03:26pm] ---> fixed issue in CSV::Handle::process()
        • [03:48pm] ---> fixed CSV::getTokenStackAsString and CSV::getCSVTokenList not correctly accessing chars/strings
        • ----- ----- ----- ----- -----
        • [03:57pm] ---> added code to CSV::Handler::process() to tidy up incomplete rows
        • ----- ----- ----- ----- -----
        • [04:07pm] ---> currently code runs and works, but to have the output/dump for fields or tables you need to define DUMP_ALL_TABLE_DATA for tables, and DUMP_ALL_FIELD_DATA for fields
        • ===== ===== ===== ===== =====
      • [05/01/23] ---> declaration and definitions of the CorbSheet stuff
        show / hide
        • ===== ===== ===== ===== =====
        • [02:55pm] ---> finished basic declarations for the CorbSheet situation
        • [03:00pm] ---> cleaned up the ./Main.cpp to use preprocessor definitions for choosing what code is run
        • ----- ----- ----- ----- -----
        • [03:06pm] ---> added in some code to use the CorbSheet code as part of Main.cpp::appHandle()
        • ----- ----- ----- ----- -----
        • [03:16pm] ---> modified cell draw structure to use more raygui functions and provided a non raygui implementation commented out
        • [03:16pm] ---> setup the CSV processing code to be used based on preprocessor value to speed up testing of the GUI code
        • ----- ----- ----- ----- -----
        • [03:23pm] ---> completed the implementation of basic CorbSheet and verified that it is working as intended, however the text size is too large and the cells are too small
        • ----- ----- ----- ----- -----
        • [03:36pm] ---> added some tasks to ./docs/README.md tasks section
        • [04:11pm] ---> completed merging stale branch structure back to main branch in github repositiory
        • ===== ===== ===== ===== =====
      • [10/01/23] ---> improvements and changes to CorbSheet/CorbTable
        show / hide
        • ===== ===== ===== ===== =====
        • [01:03pm] ---> added in some documentation to README.md for contained sub projects
        • [01:03pm] ---> hypothesized a change to the name of our library for handling the data
        • [01:11pm] ---> added a summary of written ideas to the ideas section of README.md
        • ===== ===== ===== ===== =====
  • [13/01/23] ---> port from cpp_csv_handle
    show / hide
    • ===== ===== ===== ===== =====
    • [11:57am] ---> completed restructure of notices section of README.md and copied across some of the file structur
    • [12:09pm] ---> completed porting of files and cmake configure
    • ----- ----- ----- ----- -----
    • [02:53pm] ---> began refactoring the CorbSheet.hpp to use our new formatting
    • ----- ----- ----- ----- -----
    • [05:23pm] ---> changed the CorbGrid to no longer using a cell instance
    • [05:23pm] ---> added in a task for suggested cell data handle holding references to the col/row
    • ===== ===== ===== ===== =====
  • [14/01/23] ---> minor changes
    show / hide
    • ===== ===== ===== ===== =====
    • [04:10am] ---> fixed bug in cell drawing where they werent offset by grid view space position
    • [01:14pm] ---> removed some of the TODO statements in CorbCell
    • [01:14pm] ---> changed the window title to be correct for current project
    • ----- ----- ----- ----- -----
    • [01:17pm] ---> changed README.md to strikethrough the tasks complete
    • ----- ----- ----- ----- -----
    • [01:32pm] ---> added in RefSpace which is a copy of raylib's Rectangle structure but takes references
    • [01:32pm] ---> prepared directory for initial repository push to track further changes during spelling correction/refactoring to have cell use references
    • ----- ----- ----- ----- -----
    • [02:04pm] ---> added a testing section to ./Main.cpp
    • [03:07pm] ---> provided some tested data for address containers in ./Main.cpp
    • ===== ===== ===== ===== =====
  • [16/01/23] ---> reimplementing the CorbCell objects
    show / hide
    • ===== ===== ===== ===== =====
    • [01:51pm] ---> restructured CorbCell to use a shared reference member for position/size based on col/row
    • [01:51pm] ---> restructured CorbCell draw method to use raylib methods so each cell isnt required to have a rectangle member
    • ===== ===== ===== ===== =====
  • [17/01/23] ---> changes on this day
    show / hide
    • ===== ===== ===== ===== =====
    • [11:52am] ---> changed some minor things in README.md
    • [12:15pm] ---> added in containers for color/border size/text size to the cell objects
    • ----- ----- ----- ----- -----
    • [01:16pm] ---> changed over to having variable and offsetting the drawing of cells correctly (not including grid border size)
    • ----- ----- ----- ----- -----
    • [02:27pm] ---> removed defunct overloading of grid's draw method
    • [02:27pm] ---> provided functionality for mouse hovering and mouse selection and made the position provided to grid as relative to the view space
    • ----- ----- ----- ----- -----
    • [00:00pm] --->
    • [00:00pm] --->
    • ===== ===== ===== ===== =====
  • [18/01/23] ---> changes on this day
    show / hide
    • ===== ===== ===== ===== =====
    • [12:12pm] ---> cleaned up README.md
    • ----- ----- ----- ----- -----
    • [12:26pm] ---> added in borderSize data member to CorbGrid
    • [12:26pm] ---> added in Color data members for the fill/border/hovered borders
    • [12:26pm] ---> included the border in the draw position of each cell
    • [12:26pm] ---> resolved error where it was removing the border offset on draw by not including it in the provided offset
    • [12:28pm] ---> after reveiwing changes, notice that border size doesnt need to be included in cell position
    • ----- ----- ----- ----- -----
    • [12:31pm] ---> as per previous note, removed the border size addition from each cell's position
    • ----- ----- ----- ----- -----
    • [02:05pm] ---> modified the mouse handoff from CorbSheet to CorbGrid so that the offset is handled by the grid
    • ----- ----- ----- ----- -----
    • [00:00pm] --->
    • [00:00pm] --->
    • ----- ----- ----- ----- -----
    • [00:00pm] --->
    • [00:00pm] --->
    • ===== ===== ===== ===== =====
  • [18/01/23] ---> changes on this day
    show / hide
    • ===== ===== ===== ===== =====
    • [11:53am] ---> updated the getCell in the CorbGrid so it's using the new cell format
    • [11:53am] ---> removed the cellVals list from grid, as it's defunct
    • [11:56am] ---> added getText to CorbGrid
    • [11:56am] ---> removed old todo statements and code from CorbGrid that is no longer used
    • ----- ----- ----- ----- -----
    • [00:00pm] --->
    • [00:00pm] --->
    • ===== ===== ===== ===== =====
  • [22/01/23] ---> changes on this day
    show / hide
    • ===== ===== ===== ===== =====
    • [08:10am] ---> updated the "useful to user" section of ~/docs/README.md to reflect this repository
    • ----- ----- ----- ----- -----
    • [08:35am] ---> fixed extra qualifier in the CorbGrid's getText member function
    • [08:35am] ---> added screenshot to README.md
    • ----- ----- ----- ----- -----
    • [00:00pm] --->
    • [00:00pm] --->
    • ===== ===== ===== ===== =====

Plans

show / hide

Ideas

show / hide
  • ===== ===== ===== ===== =====
  • [from source project README.md relating to this code]
    • [ show / hide ]
      • [10/01/23][01:05pm] ---> change to the structure of our CorbSheet code:
        • has offset for position of drawing pixels
        • uses drawable structure from other projects
        • calculates a cell's position and size when the table is loaded
        • change to file formatting
          • use some sort of seperator for each table contained in a file including table name
          • maybe also include the table sizing in that header
          • have a line that says the character limit of each column after the column names
          • modularise the concept of the table for the different parts?
        • have the header row as seperately stored to the table entries
        • each cell is given the data that it draws by the table? when we do concurrent stuff
        • have a cell as just a structure for relative position and size
  • ----- ----- ----- ----- -----
  • [13/01/23][05:28pm] ---> change the cell structure to be holding references for positioning, where the references are to data held in grid shared for a column or a row
  • ----- ----- ----- ----- -----
  • [00/01/23][00:00xx] --->
  • [00/01/23][00:00xx] --->
  • ----- ----- ----- ----- -----
  • [00/01/23][00:00xx] --->
  • [00/01/23][00:00xx] --->
  • ===== ===== ===== ===== =====

Tasks

show / hide
  • ===== ===== ===== ===== =====
  • [from source project README.md relating to this code]
    • [ show / hide ]
      • [05/01/23][03:27pm] ---> add in some more functionality to CorbSheet
        [ show / hide ]
        • CorbCell member variables for:
          • hover color
          • background/border color
          • text color
        • CorbGrid member variables for:
          • hover col/row index
          • background/border color
          • colWidthPx as a list
        • CorbSheet code handle for:
          • veiwing col/row index and veiwing col/row count code
          • mouse position translation to viewing row/col index
          • data handle inputing into the grid instance from 2D list of strings
  • ----- ----- ----- ----- -----
  • [13/01/23][02:53pm] ---> CorbGrid ---> change column size and row size to list
  • [13/01/23][02:53pm] ---> CorbGrid ---> add in the position vars as list for col and row
  • [13/01/23][02:53pm] ---> CorbGrid ---> add in 2D vector of strings
  • [13/01/23][02:53pm] ---> CorbGrid ---> change draw to using the new available values instead of the CorbCell instances
  • ----- ----- ----- ----- -----
  • [13/01/23][03:56pm] ---> CorbGrid ---> have the veiwing things calculated as asking if they're inside the veiwing space
  • ----- ----- ----- ----- -----
  • [16/01/23][01:05pm] ---> CorbCell ---> using the float address containers for shared memory by column/row
  • ----- ----- ----- ----- -----
  • [18/01/23][12:33pm] ---> need to restructure mouse position and veiw size calculations to not need to happen as often
  • [18/01/23][12:33pm] ---> having a calculation for if the mouse is close to a border of a cell
  • [18/01/23][12:35pm] ---> some method of selecting a cell in the grid or an array of cells in the grid
  • [18/01/23][12:35pm] ---> a handle for writing to a file the csv information
    • can use O(2N) by having it add each character to the string
    • then check off if they found a comma in the token at all
    • once the line is done, sending the whole line to the file
  • [00/01/23][00:00xx] --->
  • ----- ----- ----- ----- -----
  • [00/01/23][00:00xx] --->
  • [00/01/23][00:00xx] --->
  • ----- ----- ----- ----- -----
  • [00/01/23][00:00xx] --->
  • [00/01/23][00:00xx] --->
  • ----- ----- ----- ----- -----
  • [14/01/23][01:19pm] ---> [cpp_csv_handler] ---> get cmake to treat our code sections as static libraries correctly
  • ===== ===== ===== ===== =====

Issues

show / hide
  • ===== ===== ===== ===== =====
  • [14/01/23][01:36pm] ---> cell drawing isnt inside the border of the grid due to border going inwards from boundary pixels
  • [14/01/23][01:36pm] ---> text in cell is too far to the left
  • [14/01/23][01:36pm] ---> text in cell isnt properly shortened to the cell size
    • ( font isnt monospace so would need to be calculated from each font's glyph size )
  • [14/01/23][01:36pm] ---> currently cell isnt its own instance to improve code speed but should be used with references to shared data fields in column/row
  • [16/01/23][01:13pm] ---> cell also doesnt share the memory for column index or row index
  • ----- ----- ----- ----- -----
  • [14/01/23][01:42pm] ---> border is a magic number for cells and grid
  • [14/01/23][01:42pm] ---> no color storage for any ui elements, using magic color values
  • ----- ----- ----- ----- -----
  • [14/01/23][01:42pm] ---> incorrect spelling of "view" throughout the project as "veiw"
  • [14/01/23][01:42pm] ---> old TODO statements in code that should be updated
  • ----- ----- ----- ----- -----
  • [14/01/23][01:42pm] ---> no mouse tracking
  • ----- ----- ----- ----- -----
  • [16/01/23][01:51pm] ---> draws cells from top left without offsetting by grid position
  • ----- ----- ----- ----- -----
  • [22/01/23][08:11am] ---> as highlighted by the "useful to user" section of README.md, this repository requires you to add folders to any fetched copy of it, which should be able to be resolved by ammending ~/.gitignore
  • [22/01/23][08:11am] ---> will need to ammend/update the ~/CMakeLists.txt to auto fetch the raylib/raygui repositories
  • ----- ----- ----- ----- -----
  • [22/01/23][08:11am] ---> an update was made to the source google sheet that this repository uses for test data which should be considered further down the line (perhaps some sort of webscraping to fetch it automatically?)
  • ----- ----- ----- ----- -----
  • [00/01/23][00:00xx] --->
  • [00/01/23][00:00xx] --->
  • ----- ----- ----- ----- -----
  • [00/01/23][00:00xx] --->
  • [00/01/23][00:00xx] --->
  • [00/01/23][00:00xx] --->
  • ===== ===== ===== ===== =====

Resources

show / hide

Releases

No releases published

Packages

No packages published