namespaces

Friend classes across different namespaces. Is that possible

Hello all, I'm having problems trying to use the friend feature of C++. I have these interfaces: #pragma once #include "Mesh3D.h" #include <string> namespace tools{ namespace sysInput{ class CGeometryManager3D { public: bool loadFromFile(render::CMesh3D& mesh, std::string filename); C...

Is it a bad practice to use the name of a type for a member function or variable?

If the answer is yes, can you tell me why? here is an example: namespace urx { struct reserved { }; struct side { urx::reserved reserved() { /*...*/ } }; } int main() { urx::side side; side.reserved(); } reserved is used for both a type name and a function name. side is used for both a type name and a variable name. b...

Semicolon in namespace. Necessary?

Hello, when working with namespace, I need to finish it with a semicolon? When I put a forward declaration of a class into a namespace, for example, many people doesn't include a semicolon but, it seems to be optional. Does semicolon add functionality or change the current functionality by adding or removing? Thanks. ...

Zend framework modules and Reflection

Hello, i'm a bit confused about modules, namespace and reflection. $obj = new default_Model_foo(); $obj->bar(); The code above runs properly, but i need to add reflection; I've got these variables: $moduleName = "default"; $modelName = "foo"; $function = "bar"; I would like to instantiate a class at runtime, how can do it? Tha...

select a node with an xmlns?

I am trying to select all of the links in a xhtml document in xsl. Some of the anchor tags have the namespace declaration xmlns="http://www.w3.org/1999/xhtml" in them. These are not selected. e.g. with this xml doc: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="xsl.xsl"?> <root> <item> this iz sum text and it haz sum ...

Authlogic, Namespace and private methods in ApplicationController

Hello, I am troubleshooting why my ApplicationController's methods don't seem to work in my namespaced admin area and it seems like when I'm in a namespace I cannot access my ApplicationController's private methods, is this right? If it is like that, what's the best practise to reuse something like Authlogic's example ApplicationContro...

how to avoid Cannot redeclare class for 2 diffrent classes with same name

I'm trying to include some functions from phpBB board to my application like a single login. But if i include the common.php it says "Cannot redeclare class user", because my application already has a class user. Is there a way to avoid this ? I tried a little with namespaces, but I never worked with them. So I need a way to include 2 c...

How to resolve a name collision between a C++ namespace and a global function?

Hi, if I define a namespace log somewhere and make it accessible in the global scope, this will clash with double log(double) from the standard cmath header. Actually, most compilers seem to go along with it -- most versions of SunCC, MSVC, GCC -- but GCC 4.1.2 doesn't. Unfortunately, there seems no way to resolve the ambiguity, as usi...

Best practices for creating a namespace for an extension to another company's product?

I typically follow the Company.(Product|Technology)[.Feature][.Subnamespace] pattern encouraged by Microsoft: http://msdn.microsoft.com/en-us/library/ms229026 when naming class libraries. I'm wondering what convention to use when naming a class library that contains mostly code wrapped around another company's product. My specific case ...

Emulating namespaces in Fortran 90

One of the most troublesome issues with Fortran 90 is the lack of namespacing. In this previous question "How do you use Fortran 90 module data" from Pete, it has been discussed the main issue of USE behaving like a "from module import *" in python: everything that is declared public in the module is imported as-is within the scope of th...

How to remove the need for a namespace prefix?

I've written a class... namespace SharpQuery { public static class SharpQuery { public static IEnumerable<HtmlNode> Load(Uri uri) { // ... But when I want to call the Load method from inside a different namespace I have to write SharpQuery.SharpQuery.Load even if I put using SharpQuery; at the top. ...

Namespace refactoring tool for Eclipse?

I'm doing some housekeeping on some files, and I need to move some classes to a new namespace. Currently I have to manually edit the files, but I was wondering if there's a more efficient way of doing this? I heard about ReSharper for Visual Studio does what I need, but is there a similar tool for Eclipse? ...

Namespaces - How deep is too deep

We are currently reorganising some of our services projects so their naming is more logical. We have the following structure: Djp.Services.Type. ServiceName This seems to make sense as a logical grouping, however what I want to know is, is it acceptable to have further levels under this based on the folders in the project. For exa...

When is it appropriate to use static (over unnamed namespaces) in C++?

Hi, I have been reading articles about unnamed namespaces the whole day, most articles explained when you should use unnamed namespaces over the static keyword. But I am still left with one big question when is it appropriate to use static? After all it is not completely deprecated, what about header files with static functions should I...

Operator overloading and namespaces

Possible Duplicate: Where should non-member operator overloads be placed? While browsing on SO, I often find questions or answer that involves overloading/defining a std::ostream& operator<<(std::ostream& os, const Foo& foo) or a Foo operator+(const Foo& l, const Foo& r). While I know how and when (not) to write these operato...

Namespace issue/ conflict, why?

I am introducing a new namespace called Ebot.Mind for the class Cat namespace Ebot.Mind { class Cat { } } Now I've a one using namespace called Mind.Logging, namespace Ebot.Mind { using Mind.Logging; class Cat { } } Now when I am trying to use any functionality under Mind.Logging namespace, it is not able to find it. ...

Namespace output with XSLT 1.0 causing problems

Hi guys, i'm using XSLT 1.0 to transform some XML. I'm not quite sure the best way to explain this, so will use some examples. My input XML contains a specialization, using the xsi:type declaration. See the Payload node: <ns0:RootNode xmlns:ns0="namespace1" xmlns:ns1="namespace2" xmlns:xsi="http://www.w3.org/2001/XMLSchema"&gt; <...

does 'using' provide any advantages?

When you reference certain methods, you can either use using or explicitly type in the entire namespace. Are there any speed advantages of using one method over the other, or is it simply there to make typing out the entire namespace easier? thanks ...

What are Python namespaces all about

I have just started learning Python & have come across "namespaces" concept in Python. While I got the jist of what it is, but am unable to appreciate the gravity of this concept. Some browsing on the net revealed that one of the reasons going against PHP is that it has no native support for namespaces. Could someone explain how to us...

php5 and namespace?

Hei all. i work a lot in PHP5 but i never relly understand the namespace method in PHP can sombady help me here? i have read on php.net's website its not expalde good enof, and i can't find eks. on it. i need to know how i can make code in sample version. namespace: sample class: sample_class_1 function: test_func_1 class: sample_...