2003-09-02 10:29:05 +00:00
|
|
|
/**
|
|
|
|
* \file IdSc.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Huang Ying
|
|
|
|
*
|
2003-09-02 17:02:32 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-09-02 10:29:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "IdSc.h"
|
2004-09-26 18:36:07 +00:00
|
|
|
|
2003-09-02 10:29:05 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
|
|
using lyx::support::split;
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
|
|
|
|
2003-09-02 10:29:05 +00:00
|
|
|
|
|
|
|
/// Extract shortcut from "<identifer>|#<shortcut>" string
|
|
|
|
string const id_sc::shortcut(string const & idsc)
|
|
|
|
{
|
|
|
|
string sc = split(idsc, '|');
|
|
|
|
if (!sc.empty() && sc[0] == '#')
|
|
|
|
sc.erase(sc.begin());
|
|
|
|
return sc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Extract identifier from "<identifer>|#<shortcut>" string
|
|
|
|
string const id_sc::id(string const & idsc)
|
|
|
|
{
|
|
|
|
string id;
|
|
|
|
split(idsc, id, '|');
|
|
|
|
return id;
|
|
|
|
}
|