*/
boolean Open (in URLPath aStudyUrl) raises (SALOME::SALOME_Exception);
+/*! \brief Check if study can be opened
+
+ Tries to open and read given url.
+ \param aStudyUrl The path to the study
+*/
+ boolean CanOpen (in URLPath aStudyUrl);
+
/*! \brief Saving the study in a file (or files).
Saves a study.
return false;
std::wstring wtheStudyUrl = Kernel_Utils::decode_s( theStudyUrl );
- if (!_corba_impl->Open( (wchar_t*)wtheStudyUrl.c_str() ) )
- return false;
+ return _corba_impl->Open( (wchar_t*)wtheStudyUrl.c_str() );
+}
- return true;
+bool SALOMEDS_Study::CanOpen(const std::string& theStudyUrl)
+{
+ if(CORBA::is_nil(_corba_impl))
+ return false;
+ std::wstring wtheStudyUrl = Kernel_Utils::decode_s( theStudyUrl );
+
+ return _corba_impl->CanOpen( (wchar_t*)wtheStudyUrl.c_str() );
}
bool SALOMEDS_Study::Save(bool theMultiFile, bool theASCII)
virtual void Init();
virtual bool Open(const std::string& theStudyUrl);
+ virtual bool CanOpen(const std::string& theStudyUrl);
virtual bool Save(bool theMultiFile, bool theASCII);
virtual bool SaveAs(const std::string& theUrl, bool theMultiFile, bool theASCII);
return res;
}
+//============================================================================
+/*! Function : CanOpen
+ * Purpose : Check that a Study can be opened
+ */
+//============================================================================
+bool SALOMEDS_Study_i::CanOpen(const wchar_t* aWUrl)
+{
+ SALOMEDS::Locker lock;
+
+ Unexpect aCatch(SalomeException);
+ std::string aUrl = Kernel_Utils::encode_s(aWUrl);
+
+ return SALOMEDSImpl_Study().Open( aUrl );
+}
+
PortableServer::POA_ptr SALOMEDS_Study_i::GetThePOA()
{
return _poa;
virtual void Init();
virtual void Clear();
- //! method to Open a Study
+ //! method to open a Study
/*!
\param char* arguments, the study URL
- \return Study_ptr arguments
+ \return bool arguments
*/
virtual bool Open(const wchar_t* aStudyUrl) throw (SALOME::SALOME_Exception);
+ //! method to check that a Study can be opened
+ /*!
+ \param char* arguments, the study URL
+ \return bool arguments
+ */
+ virtual bool CanOpen(const wchar_t* aStudyUrl);
+
//! method to save a Study
virtual CORBA::Boolean Save(CORBA::Boolean theMultiFile, CORBA::Boolean theASCII);
virtual void Clear() = 0;
virtual bool Open(const std::string& theStudyUrl) = 0;
+ virtual bool CanOpen(const std::string& theStudyUrl) = 0;
virtual std::string GetPersistentReference() = 0;
virtual bool IsEmpty() = 0;