Customizing Templates for Xcode .h File

Discussion in 'Mac Programming' started by ender land, Jan 11, 2011.

  1. ender land macrumors 6502a

    Joined:
    Oct 26, 2010
    #1
    Hello everyone!

    I have been using XCode for a while now and would like to see what other people can do on this front. I modified my template .h file to do something similar to the following (for a file called Molecule.h):

    Unfortunately I have to manually change the ".h" to be "_h" each time I create new files. Considerably less work than adding all that information manually but still annoying.

    Does anyone have a quick way to do that?

    The file I will modify contains the following text, modified from original content:
    I am unsure how to manipulate the above to take the file name (without path).

    I have struggled a fair bit to find documentation on this online so any advice would be greatly appreciated!

    Thanks,
    ender
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    Prehaps try this:

    Code:
    #ifndef «FILEBASENAMEASIDENTIFIER»_H
    #define «FILEBASENAMEASIDENTIFIER»_H
    
    
    #endif
    
     
  3. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #3
    For reference:
    http://www.cocoadev.com/index.pl?XcodeProjectTemplates

    Found by entering the following into google:
    xcode template

    One of google's suggestions for search terms was:
    xcode template macros

    The results of that search have the above URL in the top 10 hits.


    Alternatively, using some of the names from the example itself, I searched for:
    xcode ORGANIZATIONNAME FILENAME

    The URL again shows up, this time in the top 5 results.
     
  4. ender land thread starter macrumors 6502a

    Joined:
    Oct 26, 2010
    #4
    Wow, thanks - I definitely missed that when searching before...
     

Share This Page