Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Plug-Ins : some suggested "case" conventions

(1/3) > >>

killerbot:
When ones creates a plug-in for Code::Blocks (focusing here on contrib plug-ins that should work under Windows and linux), the plug-in project will contain several files :
1) Source files
2) Project files (*.cbp, Makefile.am's ..)
3) manifest file
4) resource files

This causes the plug-in name (or it's ID, or whatever you like to call it) to show up in several places. The majority of those places require that name to be identical, meaning using the same case !! [On windows this is no issue, but on linux it is very important].
Let's have a look at those places where that name shows up.

But first let's decide on a name for our test case plug-in : "TestCase".

--- Quote ---This would be the *suggestion* : start every word in the name with an uppercase : JustLikeThis
--- End quote ---

Allrighty, let's continue our excursion :

1) manifest.xml

--- Code: ---<Plugin name="TestCase">
--- End code ---
--> it states the plug-in name

2) the zip file of the resources : "TestCase.zip"
 This zip file is created as a post-build step, so the correct command needs to show up in the following project files :
 TestCase.cbp (to build on windows with CB)
 TestCase-unix.cbp (to build on linux with CB)
 Makefile.am : to build on linux and windows

 Some example snippets out of those project files :

--- Code: --- <ExtraCommands>
<Add after="zip -j9 ..\..\..\devel\share\codeblocks\TestCase.zip resources\manifest.xml resources\*.xrc" />
<Mode after="always" />
</ExtraCommands>

--- End code ---


--- Code: --- <ExtraCommands>
<Add after="zip -j9 ../../../devel/share/codeblocks/TestCase.zip resources/manifest.xml resources/*.xrc" />
<Mode after="always" />
</ExtraCommands>

--- End code ---


--- Code: ---EXTRA_DIST = MyFirst.xrc MySecond.xrc manifest.xml

pkgdata_DATA = TestCase.zip
CLEANFILES = $(pkgdata_DATA)

TestCase.zip:
PWD=`pwd` cd $(srcdir) && zip $(PWD)/TestCase.zip manifest.xml *.xrc > /dev/null

--- End code ---

3) The code registering the plug-in and loading the resource :
 TestCase.cpp :

--- Code: ---// Register the plugin
namespace
{
  PluginRegistrant<TestCase> reg(_T("TestCase"));
};

/* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */

TestCase::TestCase()
{
  //ctor
  if(!Manager::LoadResource(_T("TestCase.zip")))
  {
    NotifyMissingFile(_T("TestCase.zip"));
  }
}// end of constructor

--- End code ---

4) the output "shared" library (*.so or *.dll)
Again some example snippets from the project files


--- Code: ---<Option output="..\..\..\devel\share\CodeBlocks\plugins\TestCase.dll" prefix_auto="0" extension_auto="0" />

--- End code ---


--- Code: ---<Option output="../../../devel/share/codeblocks/plugins/libTestCase.so" />

--- End code ---


--- Code: ---lib_LTLIBRARIES = libSymTab.la

libTestCase_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version

libTestCase_la_LIBADD =

libTestCase_la_SOURCES =


--- End code ---

And for consistency it's also nice if you project names are alike :

--- Code: --- <Project>
<Option title="TestCase" />

--- End code ---

takeshi miya:
I'd say:

1) CamelCase
2) lowercase
3) CamelCase
4) lowercase
5) CamelCase

In short, lowercase for all filenames, and CamelCase for everything else (project names, classes...).

mandrav:

--- Quote from: Takeshi Miya on October 24, 2006, 03:01:38 pm ---I'd say:

1) CamelCase
2) lowercase
3) CamelCase
4) lowercase
5) CamelCase

In short, lowercase for all filenames, and CamelCase for everything else (project names, classes...).

--- End quote ---

You missed the point completely.
All 5 points must match, case-sensitively (even under windows).

thomas:

--- Quote from: mandrav on October 24, 2006, 03:51:16 pm ---You missed the point completely.
All 5 points must match, case-sensitively (even under windows).
--- End quote ---
How dare you say that! Takeshi knows.

takeshi miya:

--- Quote from: mandrav on October 24, 2006, 03:51:16 pm ---You missed the point completely.

--- End quote ---
Sorry, but yes, I understood Lieven's post as something to discuss and to change...
Not how it is now.
The title "suggested case conventions" doesn't sounds like "enforced case conventions".

If this was meant as a documentation and not to discuss, one would expected it in the Wiki.


--- Quote from: thomas on October 24, 2006, 04:04:01 pm ---How dare you say that! Takeshi knows.

--- End quote ---
Bleh, but thanks for the attitude anyways.

Navigation

[0] Message Index

[#] Next page

Go to full version