Hey Joel!
If I'm reading you correctly what your suggesting is basically what I do. I
find putting each "app" in its own name space makes things more pluggable
since I can move apps between projects without worrying about name
collisions.... unless of course I have multiple apps with the same name,
which seems unlikely in my case. I normally don't divide my namespaces
based on class kind either. I let those follow names that fit them. My
application class is usually just named "app". Making it easy to remember
what gets "mounted". So for a particular app the application class name,
including namespace would be: my_app::app. And the content classes would be
something like "my_app::my_content". I put templates in the same namespace
for easy inclusion of related the related content classes. But obviously
one could put those in sub namespaces if one wished. C++CMS doesn't really
care how you name things outside of the C++ rules. :-)
- Jon
On 10/13/2020 10:09 AM, jo...@em... wrote:
> I’m planning on building a “larger” web application consisting of a complex end-user front-end and an administrator back-end.
> Splitting the application into different sub-applications as per the documentation is definitely necessary here.
>
> My question: I’d like to have a separate namespace per (sub)application. Can views & content classes also be in different namespaces.
> Basically I'd like to implement a project folder structure like this:
>
> my_fancy_server/
> ├─ apps/
> │ ├─ app_01/
> │ │ ├─ app_01.hpp
> │ │ ├─ view/
> │ │ │ ├─ foo.tmpl
> │ │ │ ├─ bar.tmpl
> │ │ ├─ content/
> │ │ │ ├─ tmpl_foo.hpp
> │ │ │ ├─ tmpl_bar.hpp
> │ ├─ app_02/
> │ │ ├─ view/
> │ │ │ ├─ bar.tmpl
> │ │ │ ├─ foo.tmpl
> │ │ ├─ content/
> │ │ │ ├─ tmpl_bar.hpp
> │ │ │ ├─ tmpl_foo.hpp
> │ │ ├─ app_02.hpp
> ├─ view/
> │ ├─ master.tmpl
> ├─ content/
> │ ├─ content.hpp
> ├─ website.hpp
> ├─ main.cpp
>
> Then I'd like each `app_xx` folder to have it's own C++ namespace. Therefore, the data/content class of `app_01/tmpl_foo.hpp` would be `apps::app_01::foo`.
>
> Is this advisable/recommended/wrong/not-optimal/perfect/ ...?
> I'd be thankful for any kind of feedback as I'd like to prevent having to re-organize everything after a few weeks of working and realizing that this is not optimal.
>
>
> Best regards,
> ~ Joel
>
>
>
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
--
Sent from my Debian Linux laptop
Jon Foster
JF Possibilities, Inc.
jo...@jf...
|