NCBI C++ ToolKit
asn_export_params.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: asn_export_params.cpp 39666 2017-10-25 16:01:13Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Roman Katargin
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
35 
37 
38 #include <wx/filename.h>
39 
41 
43 {
44  Init();
45 }
47 {
48  Init();
49  Copy(data);
50 }
52 {
53 }
55 {
56  Copy(data);
57 }
59 {
60 ////@begin CAsnExportParams equality operator
61  if (!(m_AsnType == data.m_AsnType)) return false;
62  if (!(m_FileName == data.m_FileName)) return false;
63 ////@end CAsnExportParams equality operator
64  return true;
65 }
67 {
68 ////@begin CAsnExportParams copy function
69  m_AsnType = data.m_AsnType;
70  m_FileName = data.m_FileName;
71 ////@end CAsnExportParams copy function
72 
73  m_Objects = data.m_Objects;
74 }
76 {
77 ////@begin CAsnExportParams member initialisation
78  m_AsnType = 0;
79 ////@end CAsnExportParams member initialisation
80 }
81 
82 static const char* kAsnType = "AsnType";
83 static const char* kFileNameUTF8 = "FileNameUTF8";
84 
85 /// IRegSettings
87 {
88  if (!m_RegPath.empty()) {
91 
92  view.Set(kAsnType, m_AsnType);
93  view.Set(kFileNameUTF8, m_FileName.ToUTF8());
94  }
95 }
96 
98 {
99  if (!m_RegPath.empty()) {
101  CRegistryReadView view = gui_reg.GetReadView(m_RegPath);
102 
104  m_FileName = wxString::FromUTF8(view.GetString(kFileNameUTF8, string(m_FileName.ToUTF8())).c_str());
105  }
106 }
107 
108 void CAsnExportParams::UpdateFileName(const wxString& fname)
109 {
110  if (fname.empty())
111  return;
112 
113  wxFileName fileName(fname);
114  if (!m_FileName.empty()) {
115  wxFileName origFileName(m_FileName);
116  origFileName.SetFullName(fileName.GetFullName());
117  m_FileName = origFileName.GetFullPath();
118  }
119  else {
120  m_FileName = fileName.GetFullPath();
121  }
122 }
123 
static const char * kFileNameUTF8
static const char * kAsnType
void UpdateFileName(const wxString &fname)
void operator=(const CAsnExportParams &data)
void Copy(const CAsnExportParams &data)
virtual void SaveSettings() const
IRegSettings.
TConstScopedObjects m_Objects
bool operator==(const CAsnExportParams &data) const
virtual void LoadSettings()
CRegistryWriteView GetWriteView(const string &section)
get a read-write view at a particular level.
Definition: registry.cpp:462
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CRegistryReadView GetReadView(const string &section) const
get a read-only view at a particular level.
Definition: registry.cpp:428
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
Definition: reg_view.cpp:230
string GetString(const string &key, const string &default_val=kEmptyStr) const
Definition: reg_view.cpp:246
void Set(const string &key, int val)
access a named key at this level, with no recursion
Definition: reg_view.cpp:533
char data[12]
Definition: iconv.c:80
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Modified on Fri Sep 20 14:57:19 2024 by modify_doxy.py rev. 669887