");
} else {
PageData.append("");
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Birthday:"));
PageData.append(wxT(" "));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Process Anniversary
ContactData = vCardObj->GetByPartial(wxT("ANNIVERSARY"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString AnniLine;
for (int i = 0; i < ContactData.PropCount; i++){
// Grab the first anniversary only.
AnniLine = ContactData.PropValues[i];
AnniLine.Trim();
if (AnniLine.Mid(0,4) == wxT("1604")){
AnniLine = AnniLine.Mid(4,4);
AnniLine.Mid(0,2).ToLong(&MonthValue);
AnniLine.Mid(2,2).ToLong(&DayValue);
MonthValue--;
DateFormat.Set((wxDateTime::wxDateTime_t)(int)DayValue, (wxDateTime::Month)(MonthValue), 0, 0, 0, 0, 0);
} else if (AnniLine.Mid(0,2) == wxT("--")){
AnniLine = AnniLine.Mid(2,4);
AnniLine.Mid(0,2).ToLong(&MonthValue);
AnniLine.Mid(2,2).ToLong(&DayValue);
MonthValue--;
DateFormat.Set((wxDateTime::wxDateTime_t)(int)DayValue, (wxDateTime::Month)(MonthValue), 0, 0, 0, 0, 0);
} else {
AnniLine.Mid(0,4).ToLong(&YearValue);
AnniLine.Mid(4,2).ToLong(&MonthValue);
AnniLine.Mid(6,2).ToLong(&DayValue);
MonthValue--;
DateFormat.Set((wxDateTime::wxDateTime_t)(int)DayValue, (wxDateTime::Month)(MonthValue), YearValue, 0, 0, 0, 0);
}
wxString AnniDayOutput;
AnniDayOutput.append(wxString::Format(wxT("%02i"), (int)DayValue));
AnniDayOutput.append(wxT("/"));
AnniDayOutput.append(wxString::Format(wxT("%02i"), (int)(MonthValue + 1)));
if (DateFormat.GetYear() != 0){
AnniDayOutput.append(wxT("/"));
AnniDayOutput.append(wxString::Format(wxT("%04i"), (int)YearValue));
}
CaptureString(&AnniDayOutput, FALSE);
ConvertToHTML(&AnniDayOutput);
DataLines.append(AnniDayOutput);
break;
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Anniversary:"));
PageData.append(wxT(" "));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Nickname
ContactData = vCardObj->GetByPartial(wxT("NICKNAME"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString NicknameLine;
for (int i = 0; i < ContactData.PropCount; i++){
NicknameLine = ContactData.PropValues[i];
NicknameLine.Trim();
CaptureString(&NicknameLine, FALSE);
ConvertToHTML(&NicknameLine);
DataLines.append(wxT(" | "));
DataLines.append(_("Nickname:"));
DataLines.append(wxT(" | "));
DataLines.append(NicknameLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Nicknames"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Address
ContactData = vCardObj->GetByPartial(wxT("ADR"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString AddressLine;
for (int i = 0; i < ContactData.PropCount; i++){
AddressLine = ContactData.PropValues[i];
intPropertyLen = AddressLine.Len();
SplitPoints.clear();
SplitLength.clear();
intSplitsFound = 0;
intSplitSize = 0;
intPrevValue = 0;
AddressPOBox.clear();
AddressStreet.clear();
AddressLocality.clear();
AddressRegion.clear();
AddressPostalCode.clear();
AddressCountry.clear();
AddressExtended.clear();
FinalAddressLine.clear();
AddressFirst = TRUE;
for (int i = 0; i <= intPropertyLen; i++){
intSplitSize++;
if (AddressLine.Mid(i, 1) == wxT(";") && AddressLine.Mid((i - 1), 1) != wxT("\\")){
intSplitsFound++;
SplitPoints.insert(std::make_pair(intSplitsFound, (i + 1)));
if (intSplitsFound == 6){
SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
break;
} else {
SplitLength.insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
}
intSplitSize = 0;
}
}
// Split the data into several parts.
for (std::map::iterator intiter = SplitPoints.begin();
intiter != SplitPoints.end(); ++intiter){
if (intiter->first == 1){
// Deal with PO Box.
SLiter = SplitLength.find(1);
AddressPOBox = AddressLine.Mid(0, SLiter->second);
intPrevValue = intiter->second;
} else if (intiter->first == 2){
// Deal with extended address.
SLiter = SplitLength.find(2);
AddressExtended = AddressLine.Mid(intPrevValue, SLiter->second);
intPrevValue = intiter->second;
} else if (intiter->first == 3){
// Deal with street address.
SLiter = SplitLength.find(3);
AddressStreet = AddressLine.Mid(intPrevValue, SLiter->second);
intPrevValue = intiter->second;
} else if (intiter->first == 4){
// Deal with locality
SLiter = SplitLength.find(4);
AddressLocality = AddressLine.Mid(intPrevValue, SLiter->second);
intPrevValue = intiter->second;
} else if (intiter->first == 5){
// Deal with region.
SLiter = SplitLength.find(5);
AddressRegion = AddressLine.Mid(intPrevValue, SLiter->second);
intPrevValue = intiter->second;
} else if (intiter->first == 6){
// Deal with post code.
SLiter = SplitLength.find(6);
AddressPostalCode = AddressLine.Mid(intPrevValue, SLiter->second);
intPrevValue = intiter->second;
// Deal with country.
AddressCountry = AddressLine.Mid(intPrevValue);
}
}
if (!AddressStreet.IsEmpty()){
AddressStreet.Trim();
ConvertToHTML(&AddressStreet);
FinalAddressLine.append(AddressStreet);
AddressFirst = FALSE;
}
if (!AddressLocality.IsEmpty()){
AddressLocality.Trim();
ConvertToHTML(&AddressLocality);
if (AddressFirst == FALSE){
FinalAddressLine.append(wxT(", "));
FinalAddressLine.append(AddressLocality);
} else {
FinalAddressLine.append(AddressLocality);
AddressFirst = FALSE;
}
}
if (!AddressRegion.IsEmpty()){
AddressRegion.Trim();
ConvertToHTML(&AddressRegion);
if (AddressFirst == FALSE){
FinalAddressLine.append(wxT(", "));
FinalAddressLine.append(AddressRegion);
} else {
FinalAddressLine.append(AddressRegion);
AddressFirst = FALSE;
}
}
if (!AddressPostalCode.IsEmpty()){
AddressPostalCode.Trim();
ConvertToHTML(&AddressPostalCode);
if (AddressFirst == FALSE){
FinalAddressLine.append(wxT(", "));
FinalAddressLine.append(AddressPostalCode);
} else {
FinalAddressLine.append(AddressPostalCode);
AddressFirst = FALSE;
}
}
if (!AddressCountry.IsEmpty()){
AddressCountry.Trim();
ConvertToHTML(&AddressCountry);
if (AddressFirst == FALSE){
FinalAddressLine.append(wxT(", "));
FinalAddressLine.append(AddressCountry);
} else {
FinalAddressLine.append(AddressCountry);
AddressFirst = FALSE;
}
}
CaptureString(&FinalAddressLine, FALSE);
DataLines.append(wxT(""));
DataLines.append(_("Address:"));
DataLines.append(wxT(" | "));
DataLines.append(FinalAddressLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Addresses"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Email
ContactData = vCardObj->GetByPartial(wxT("EMAIL"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString EmailLine;
for (int i = 0; i < ContactData.PropCount; i++){
EmailLine = ContactData.PropValues[i];
EmailLine.Trim();
CaptureString(&EmailLine, FALSE);
ConvertToHTML(&EmailLine);
DataLines.append(wxT(""));
DataLines.append(_("E-mail Address:"));
DataLines.append(wxT(" | "));
DataLines.append(EmailLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Email Addresses"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Telephone
ContactData = vCardObj->GetByPartial(wxT("TEL"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString TelLine;
for (int i = 0; i < ContactData.PropCount; i++){
TelLine = ContactData.PropValues[i];
wxStringTokenizer TelSplit(TelLine, wxT(":"));
TelLine = TelSplit.GetNextToken();
if (TelSplit.HasMoreTokens()){
TelLine = TelSplit.GetNextToken();
}
TelLine.Trim();
CaptureString(&TelLine, FALSE);
ConvertToHTML(&TelLine);
DataLines.append(wxT(""));
DataLines.append(_("Telephone:"));
DataLines.append(wxT(" | "));
DataLines.append(TelLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Telephones"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Instant Messaging
ContactData = vCardObj->GetByPartial(wxT("IMPP"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString IMLine;
wxString IMTypeFriendly;
wxString IMType;
for (int i = 0; i < ContactData.PropCount; i++){
IMLine = ContactData.PropValues[i];
wxStringTokenizer IMSplit(IMLine, wxT(":"));
IMType = IMSplit.GetNextToken();
IMLine = IMSplit.GetNextToken();
// Process skype, gg, icq, yahoo etc into
// something meaningful.
if (IMType == wxT("aim")){
// AIM
IMTypeFriendly = _("AIM");
} else if (IMType == wxT("xmpp")){
// XMPP
IMTypeFriendly = _("XMPP");
} else if (IMType == wxT("icq")){
// ICQ
IMTypeFriendly = _("ICQ");
} else if (IMType == wxT("skype")){
// Skype
IMTypeFriendly = _("Skype");
} else if (IMType == wxT("gg")){
// Gadu-Gadu
IMTypeFriendly = _("Gadu-Gadu");
} else if (IMType == wxT("yahoo")){
// Yahoo
IMTypeFriendly = _("Yahoo");
} else {
// Other. Use IM type that was split.
IMTypeFriendly = IMType;
}
IMLine.Trim();
CaptureString(&IMLine, FALSE);
ConvertToHTML(&IMLine);
DataLines.append(wxT(""));
DataLines.append(_("IM Address"));
DataLines.append(_(" ("));
DataLines.append(IMTypeFriendly);
DataLines.append(_("):"));
DataLines.append(wxT(" | "));
DataLines.append(IMLine);
DataLines.append(wxT(" | "));
IMTypeFriendly.clear();
IMType.clear();
IMLine.clear();
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Instant Messaging Addresses"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// URL
ContactData = vCardObj->GetByPartial(wxT("URL"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString URLLine;
for (int i = 0; i < ContactData.PropCount; i++){
URLLine = ContactData.PropValues[i];
URLLine.Trim();
CaptureString(&URLLine, FALSE);
ConvertToHTML(&URLLine);
DataLines.append(wxT(""));
DataLines.append(_("Website:"));
DataLines.append(wxT(" | "));
DataLines.append(URLLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Website Addresses"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Languages
ContactData = vCardObj->GetByPartial(wxT("LANG"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString NicknameLine;
for (int i = 0; i < ContactData.PropCount; i++){
NicknameLine = ContactData.PropValues[i];
NicknameLine.Trim();
CaptureString(&NicknameLine, FALSE);
ConvertToHTML(&NicknameLine);
DataLines.append(wxT(""));
DataLines.append(_("Language:"));
DataLines.append(wxT(" | "));
DataLines.append(NicknameLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Languages"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Timezones
ContactData = vCardObj->GetByPartial(wxT("TZ"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString NicknameLine;
for (int i = 0; i < ContactData.PropCount; i++){
NicknameLine = ContactData.PropValues[i];
NicknameLine.Trim();
CaptureString(&NicknameLine, FALSE);
ConvertToHTML(&NicknameLine);
DataLines.append(wxT(""));
DataLines.append(_("Timezone:"));
DataLines.append(wxT(" | "));
DataLines.append(NicknameLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Timezones"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Geopositioning
ContactData = vCardObj->GetByPartial(wxT("GEO"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString GeoLine;
for (int i = 0; i < ContactData.PropCount; i++){
GeoLine = ContactData.PropValues[i];
wxStringTokenizer GeoSplit(GeoLine, wxT(":"));
GeoLine = GeoSplit.GetNextToken();
if (GeoSplit.HasMoreTokens()){
GeoLine = GeoSplit.GetNextToken();
}
GeoLine.Trim();
CaptureString(&GeoLine, FALSE);
ConvertToHTML(&GeoLine);
DataLines.append(wxT(""));
DataLines.append(_("Geoposition:"));
DataLines.append(wxT(" | "));
DataLines.append(GeoLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Geopositioning"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Titles
ContactData = vCardObj->GetByPartial(wxT("TITLE"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString TitleLine;
for (int i = 0; i < ContactData.PropCount; i++){
TitleLine = ContactData.PropValues[i];
TitleLine.Trim();
CaptureString(&TitleLine, FALSE);
ConvertToHTML(&TitleLine);
DataLines.append(wxT(""));
DataLines.append(_("Title:"));
DataLines.append(wxT(" | "));
DataLines.append(TitleLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Titles"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Roles
ContactData = vCardObj->GetByPartial(wxT("ROLE"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString RoleLine;
for (int i = 0; i < ContactData.PropCount; i++){
RoleLine = ContactData.PropValues[i];
RoleLine.Trim();
CaptureString(&RoleLine, FALSE);
ConvertToHTML(&RoleLine);
DataLines.append(wxT(""));
DataLines.append(_("Role:"));
DataLines.append(wxT(" | "));
DataLines.append(RoleLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Roles"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Organisations
ContactData = vCardObj->GetByPartial(wxT("ORG"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString OrgLine;
for (int i = 0; i < ContactData.PropCount; i++){
OrgLine = ContactData.PropValues[i];
OrgLine.Trim();
CaptureString(&OrgLine, FALSE);
ConvertToHTML(&OrgLine);
DataLines.append(wxT(""));
DataLines.append(_("Organisation:"));
DataLines.append(wxT(" | "));
DataLines.append(OrgLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Organisations"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Categories
ContactData = vCardObj->GetByPartial(wxT("CATEGORIES"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString CatLine;
for (int i = 0; i < ContactData.PropCount; i++){
CatLine = ContactData.PropValues[i];
CatLine.Trim();
CaptureString(&CatLine, FALSE);
ConvertToHTML(&CatLine);
DataLines.append(wxT(""));
DataLines.append(_("Category:"));
DataLines.append(wxT(" | "));
DataLines.append(CatLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Categories"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Groups
// Calendar Addresses
ContactData = vCardObj->GetByPartial(wxT("CALURI"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString CalURILine;
for (int i = 0; i < ContactData.PropCount; i++){
CalURILine = ContactData.PropValues[i];
CalURILine.Trim();
CaptureString(&CalURILine, FALSE);
ConvertToHTML(&CalURILine);
DataLines.append(wxT(""));
DataLines.append(_("Calendar Address:"));
DataLines.append(wxT(" | "));
DataLines.append(CalURILine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Calendar Addresses"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Calendar Request Addresses
ContactData = vCardObj->GetByPartial(wxT("CALADRURI"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString CalAdrURILine;
for (int i = 0; i < ContactData.PropCount; i++){
CalAdrURILine = ContactData.PropValues[i];
CalAdrURILine.Trim();
CaptureString(&CalAdrURILine, FALSE);
ConvertToHTML(&CalAdrURILine);
DataLines.append(wxT(""));
DataLines.append(_("Calendar Request Address:"));
DataLines.append(wxT(" | "));
DataLines.append(CalAdrURILine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Calendar Request Addresses"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Free/Busy Addresses
ContactData = vCardObj->GetByPartial(wxT("FBURL"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString FBURLLine;
for (int i = 0; i < ContactData.PropCount; i++){
FBURLLine = ContactData.PropValues[i];
FBURLLine.Trim();
CaptureString(&FBURLLine, FALSE);
ConvertToHTML(&FBURLLine);
DataLines.append(wxT(""));
DataLines.append(_("Free/Busy Address:"));
DataLines.append(wxT(" | "));
DataLines.append(FBURLLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
DataLines.Trim();
PageData.append(wxT(""));
PageData.append(_("Free/Busy Addresses"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Notes
ContactData = vCardObj->GetByPartial(wxT("NOTE"));
DataDisplay = FALSE;
DataLines.clear();
if (ContactData.PropCount > 0){
wxString NoteLine;
for (int i = 0; i < ContactData.PropCount; i++){
NoteLine = ContactData.PropValues[i];
NoteLine.Trim();
CaptureString(&NoteLine, FALSE);
ConvertToHTML(&NoteLine);
DataLines.append(wxT(""));
DataLines.append(_("Note:"));
DataLines.append(wxT(" | "));
DataLines.append(NoteLine);
DataLines.append(wxT(" | "));
}
DataDisplay = TRUE;
}
if (DataDisplay == TRUE){
PageData.append(wxT(""));
PageData.append(_("Notes"));
PageData.append(wxT(""));
PageData.append(wxT(" "));
PageData.append(wxT(""));
PageData.append(DataLines);
PageData.append(wxT(" "));
}
// Display the HTML document on the screen.
PageData.append(" ");
PageData.append(wxT(""));
PageData.append(wxT(""));
HTMLObj->SetPage(PageData);
}
void SplitPropertyData(wxString *PropertyLine,
std::map *SplitPoints,
std::map *SplitLength,
int intSize,
std::map *SplitData){
// Split the property data into SplitData.
wxString DataStr;
wxStringTokenizer PropertyElement;
wxString PropertyName;
wxString PropertyValue;
int intPropertyLen = PropertyLine->Len();
int intSplitsFound = 0;
int intSplitSize = 0;
int intSplitSeek = (intSize - 1);
for (int i = intSize; i <= intPropertyLen; i++){
intSplitSize++;
if (PropertyLine->Mid(i, 1) == wxT(";") &&
PropertyLine->Mid((i - 1), 1) != wxT("\\")){
if (intSplitsFound == 0){
DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize));
SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize)));
} else {
DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize - 1));
SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1)));
}
SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1)));
intSplitsFound++;
intSplitSeek = (i + 1);
intSplitSize = 0;
if (!DataStr.IsEmpty()){
PropertyElement.SetString(DataStr, wxT("="));
PropertyName = PropertyElement.GetNextToken();
PropertyValue = PropertyElement.GetNextToken();
SplitData->insert(std::make_pair(PropertyName, PropertyValue));
}
DataStr.clear();
PropertyName.clear();
PropertyValue.clear();
}
}
if (intSplitsFound == 0){
DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize));
SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1)));
SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
} else {
DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize - 1));
SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1)));
SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize));
}
if (!DataStr.IsEmpty()){
PropertyElement.SetString(DataStr, wxT("="));
PropertyName = PropertyElement.GetNextToken();
PropertyValue = PropertyElement.GetNextToken();
SplitData->insert(std::make_pair(PropertyName, PropertyValue));
}
} |