Click here to Skip to main content
15,892,809 members
Articles / Desktop Programming / MFC

SolidGraph CAD System

Rate me:
Please Sign up or sign in to vote.
4.97/5 (78 votes)
12 Sep 20062 min read 375.7K   29.8K   209  
A SolidGraph CAD system source code.
/* ==========================================================================
	Author :		Johan Rosengren, Abstrakt Mekanik AB

	Date :			2004-06-21

	Purpose :		Misc string-related functions

	Description :	Contains several string-related function.

	Usage :			Call as needed.

   ========================================================================*/
#include "stdafx.h"
#include "StringHelpers.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

void MakeSaveString( CString& str )
{

	// This function replaces some non-alphanumeric 
	// character with tag-codes, as the characters 
	// are used for delimiting different kind of 
	// substrings.

	str.Replace( _T( ":" ), _T( "\\colon" ) );
	str.Replace( _T( ";" ), _T( "\\semicolon" ) );
	str.Replace( _T( "," ), _T( "\\comma" ) );
	str.Replace( _T( "|" ), _T( "\\bar" ) );
	str.Replace( _T( "#" ), _T( "\\hash" ) );
	str.Replace( _T( "\r\n" ), _T( "\\newline" ) );

}

void UnmakeSaveString( CString& str )
{

	// The function replaces some tag-strings 
	// with the corresponding characters after 
	// loading the string from file.

	str.Replace( _T( "\\colon" ), _T( ":" ) );
	str.Replace( _T( "\\semicolon" ) , _T( ";" ) );
	str.Replace( _T( "\\comma" ), _T( "," ) );
	str.Replace( _T( "\\bar" ), _T( "|" ) );
	str.Replace( _T( "\\hash" ), _T( "#" ) );
	str.Replace( _T( "\\newline" ), _T( "\r\n" ) );

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions