Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

sohang3112/generic-table

Repository files navigation

Generic Table (School Project)

Description

It is basically a command-line version of a (very stripped-down!) table editing program such as MS Excel. Its command line interface allows you to create, open or modify 'generic' tables, i.e., you choose which and how many columns you want in a table. In the table, you have the options to:

  • Display whole table. (in tabular form, nice features could be adjustable column width, word wrapping within columns)
  • Add a row (must fill all columns).
  • Edit a cell in a row (to edit whole row, type column-name '.').
  • Find a cell using a field (column) name.
  • Delete table.

Bugs

  • Displaying the table (in tabular format) crashes program

Ideas

  • Default Field Values: When user is adding/modifying record, and leaves a field blank, then a default value for the field could be used (and setting the default field value could be done by showing an option for this in menu).
  • Menu Options (added)
    • Templates: (Named) A set of column titles, that can be selected in one go using template name
    • Configurable settings: Ability to manipulate settings such as user prompt, table boundary characters, etc. (Convert macros in settings.hpp to variables that can be manipulated in menu.)

Style Guide

(mostly borrowed from online style guides)

  • Try to avoid macros, pointers, goto.
    (If you must use pointers, don't use raw pointers, use smart pointers instead.)
  • Use int main() {... return 0; } pattern.
  • Use four spaces (NOT tab) for indentation.
  • Always use header guards in header files.
    Example:
    /* Module documentation */
    
    #ifndef MODULENAME_INC
    #define MODULENAME_INC
    
    ...
    
    #endif       //MODULENAME_INC
  • Use cout for normal output, cerr for error messages.
  • Error messages should be of the form 'ERROR: Error message'
  • When a function pointer needs to be stored or passed to a function, then always use typedef.
    Example:
    //avoid this
    void do_something(void (*func)(int));
    
    //do this instead
    typedef void (*Callback)(int);
    void do_something(Callback func);
  • Function/Class/Variable names must be descriptive, yet not too long.
    eg. getName(), setName() //accessor functions
    isRunning() //boolean state functions
    toString() //conversion functions
    Note: If a short form is used in a name, then do NOT use all caps.
    eg. validateHtml() not validateHTML()

Naming Conventions

  • MACRO_WORDS - Completely upper-case, use underscore between words.
  • ClassName - Upper camel case (First letter in upper-case, first word of each word capital).
  • classMemberFunctions - Lower camel case (First letter in lower case, first word of each word capital).
  • variable_name - Underscore case (Completely lower-case, underscore between words).

Documentation

  • Describe a module (header file) in its first line using multi-line comment form /* ... */
  • Describe a class or function before its definition using single-line comment form // ... .
    Example:
    /* Example module
     * Documentation
     * Provides some functionality
     */
    
    //Example class
    //represents something
    class SomeClass {
        ...
    };
    
    //Example function
    //does something
    void some_function() {
        ...
    }
  • Add single-line comments wherever appropriate.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages