Thread: Need suggestions for common C++ functions/macros/etc.

  1. #1
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313

    Need suggestions for common C++ functions/macros/etc.

    I'm writing a program that is supposed to make writing HTML / C++ / ... easier. Basically, it has drop-down menus that have common macros (for lack of a better word) available.

    Screenshot illustrations of what I mean:

    http://lithorien.net:5001/ss1.jpg
    http://lithorien.net:5001/ss2.jpg

    What I need from ya'll are ideas for what to add for C++ macros that are commonly used.

    Thanks in advance.



    P.S: Program link is here - http://lithorien.net:5001/ProgEd.zip && http://lithorien.net:5001/main.cpp (for those who won't run without source) if you want to look.

  2. #2
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    You misspelled "integer."

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    you could create a macro to create and read in variables from a file, or to safely and cleanly allocate and deallocate memory...
    Last edited by major_small; 04-02-2005 at 02:31 PM. Reason: more words, two to be exact.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  4. #4
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    So what do "C++ Standard Setup" and "Boolean" etc. do?

    *EDIT*
    I see. If you ask me though, I'd prefer to type it all in myself (i.e. for the Integer thing, it's easier to just say "int x;" (enter) rather than go alt-c-i-x-right arrow (enter). Neat idea though.
    Last edited by Hunter2; 04-02-2005 at 06:44 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  5. #5
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    I'd have to agree with Hunter2 here... besides, if you use stuff like that too much, you forget how to do it on your own
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  6. #6
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Quote Originally Posted by major_small
    I'd have to agree with Hunter2 here... besides, if you use stuff like that too much, you forget how to do it on your own
    Those are basically placeholders / examples. Eventually, I'm going to be putting functions in (file read/write, winsock initalization, etc) but I wanted to get ideas for the functions I should be putting in.

    Once you've done it a lot, things get easier to just macro out.

  7. #7
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Quote Originally Posted by major_small
    you could create a macro to create and read in variables from a file, or to safely and cleanly allocate and deallocate memory...
    These are what I'm looking for. Thank ye.

  8. #8
    Registered User
    Join Date
    Oct 2003
    Posts
    29
    How about you make them customizable. Add a few as examples though.

  9. #9
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Quote Originally Posted by rainmanddw
    How about you make them customizable. Add a few as examples though.
    Good idea - I may well do that.

    Likely an .ini file at that point..

    [user1]
    // code

    [user2]
    //code

    [user3]
    //code..

  10. #10
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Make it more scripting-ish, for example a syntax such as:
    Code:
    [macro name]
    $headers
    (required headers)
    
    $inputs
    "prompt phrase 1" "initial text" "default value"
    "prompt phrase 2" "initial text 2" forceinput <-disallow empty input
    
    $code
    (some code) $1 (some other code)
    (lalala) $2
    $1 and $2 would be replaced with user input that is acquired from message prompts as specified in the $inputs section or something.

    For example:
    Code:
    [Open File for Read]
    $headers
    <fstream>
    
    $inputs
    "Enter object name:" "" "fileIn"
    "Enter filename:" "" forceinput
    "Additional flags (optional):" "" "0"
    
    $code
    std::ifstream $1($2, $3);
    if(!$1)
    {
       //-- Insert error handling here --
    }
    Just some ideas Something like this would add a LOT of flexibility to the macro feature.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  11. #11
    Registered User
    Join Date
    Aug 2004
    Location
    San Diego, CA
    Posts
    313
    Quote Originally Posted by Hunter2
    Make it more scripting-ish, for example a syntax such as:
    Code:
    [macro name]
    $headers
    (required headers)
    
    $inputs
    "prompt phrase 1" "initial text" "default value"
    "prompt phrase 2" "initial text 2" forceinput <-disallow empty input
    
    $code
    (some code) $1 (some other code)
    (lalala) $2
    $1 and $2 would be replaced with user input that is acquired from message prompts as specified in the $inputs section or something.

    For example:
    Code:
    [Open File for Read]
    $headers
    <fstream>
    
    $inputs
    "Enter object name:" "" "fileIn"
    "Enter filename:" "" forceinput
    "Additional flags (optional):" "" "0"
    
    $code
    std::ifstream $1($2, $3);
    if(!$1)
    {
       //-- Insert error handling here --
    }
    Just some ideas Something like this would add a LOT of flexibility to the macro feature.
    Good idea. I may have two sections so that everyone doesn't have to reinvent the wheel - C++ that I add, and then just a general "Macros" bar for anyone to use.

    How d'ya think that sounds?

  12. #12
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    INI format doesn't seem too well suited for this. You'd get a lot more power using an XML format.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  13. #13
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I vote for .txt

    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  14. #14
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    You misspelled "integer."
    Isn't it "misspelt"?

  15. #15
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Not necessarily:
    mis新pell Audio pronunciation of "misspelt" ( P ) Pronunciation Key (ms-spl)
    tr.v. mis新pelled, or mis新pelt (-splt) mis新pell搏ng, mis新pells
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Suggestions and question about bool pointers
    By Akkernight in forum C++ Programming
    Replies: 15
    Last Post: 03-22-2009, 12:27 PM
  2. Suggestions?!
    By liljp617 in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 10-20-2008, 11:12 AM
  3. Free Book Suggestions!
    By valaris in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-08-2008, 10:25 AM
  4. Math Book Suggestions
    By curlious in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-09-2003, 10:43 AM
  5. Suggestions.
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 02-06-2002, 12:21 PM