2 * Copyright 2013, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
5 #include "TeamFileManagerSettings.h"
7 TeamFileManagerSettings::TeamFileManagerSettings()
14 TeamFileManagerSettings::~TeamFileManagerSettings()
19 TeamFileManagerSettings
&
20 TeamFileManagerSettings::operator=(const TeamFileManagerSettings
& other
)
22 fValues
= other
.fValues
;
29 TeamFileManagerSettings::ID() const
36 TeamFileManagerSettings::SetTo(const BMessage
& archive
)
49 TeamFileManagerSettings::WriteTo(BMessage
& archive
) const
62 TeamFileManagerSettings::CountSourceMappings() const
67 if (fValues
.GetInfo("source:mapping", &type
, &count
) == B_OK
)
75 TeamFileManagerSettings::AddSourceMapping(const BString
& sourcePath
,
76 const BString
& locatedPath
)
79 if (mapping
.AddString("source:path", sourcePath
) != B_OK
80 || mapping
.AddString("source:locatedpath", locatedPath
) != B_OK
81 || fValues
.AddMessage("source:mapping", &mapping
) != B_OK
) {
90 TeamFileManagerSettings::RemoveSourceMappingAt(int32 index
)
92 return fValues
.RemoveData("source:mapping", index
);
97 TeamFileManagerSettings::GetSourceMappingAt(int32 index
, BString
& sourcePath
,
101 status_t error
= fValues
.FindMessage("source:mapping", index
, &mapping
);
105 error
= mapping
.FindString("source:path", &sourcePath
);
109 return mapping
.FindString("source:locatedpath", &locatedPath
);
113 TeamFileManagerSettings
*
114 TeamFileManagerSettings::Clone() const
116 TeamFileManagerSettings
* settings
= new(std::nothrow
)
117 TeamFileManagerSettings();
119 if (settings
== NULL
)
122 if (settings
->SetTo(fValues
) != B_OK
) {