[SAGA-RG] Semantics of the ns_entry constructor
'Andre Merzky'
andre at merzky.net
Mon Aug 17 08:07:35 CDT 2009
Quoting [Hartmut Kaiser] (Aug 17 2009):
>
> What should be the outcome of the following:
>
> saga::url u ("file://localhost/etc/");
> saga::file::entry e(u);
> if (e.get_type() == saga::object::File)
> cout << "e is an entry";
> else if (e.get_type() == saga::object::Directory))
> cout << "e is a directory";
>
> ? IOW, what's the type of the created object? I think in our implementation
> it will report to be a directory, actually.
But, the object type *is* entry, and actually that is also
what our implementation reports:
------------------------------------------------------------
Jonas merzky ~/test : cat entry.cpp
#include <saga/saga.hpp>
int main ()
{
saga::url u ("file://localhost/etc/");
saga::name_space::entry e (u);
if ( e.get_type () == saga::object::File )
{
std::cout << "e is an entry" << std::endl;
}
else if ( e.get_type () == saga::object::Directory )
{
std::cout << "e is a directory" << std::endl;
}
return 0;
}
Jonas merzky ~/test : make entry
make: `entry' is up to date.
Jonas merzky ~/test : ./entry
e is an entry
------------------------------------------------------------
Otherwise the entry c'tor would indeed create an c++ dir
object - how could that work?
Andre.
--
Nothing is ever easy.
More information about the saga-rg
mailing list