Line | |
---|
1 |
|
---|
2 | /* -------------------------------------------------------------------------
|
---|
3 | * Bernese NTRIP Client
|
---|
4 | * -------------------------------------------------------------------------
|
---|
5 | *
|
---|
6 | * Class: bncutils
|
---|
7 | *
|
---|
8 | * Purpose: Auxiliary Functions
|
---|
9 | *
|
---|
10 | * Author: L. Mervart
|
---|
11 | *
|
---|
12 | * Created: 30-Aug-2006
|
---|
13 | *
|
---|
14 | * Changes:
|
---|
15 | *
|
---|
16 | * -----------------------------------------------------------------------*/
|
---|
17 |
|
---|
18 | #include <QRegExp>
|
---|
19 | #include <QStringList>
|
---|
20 |
|
---|
21 | #include "bncutils.h"
|
---|
22 |
|
---|
23 | void expandEnvVar(QString& str) {
|
---|
24 |
|
---|
25 | QRegExp rx("(\\$\\{.+\\})");
|
---|
26 |
|
---|
27 | if (rx.indexIn(str) != -1) {
|
---|
28 | QStringListIterator it(rx.capturedTexts());
|
---|
29 | if (it.hasNext()) {
|
---|
30 | QString rxStr = it.next();
|
---|
31 | QString envVar = rxStr.mid(2,rxStr.length()-3);
|
---|
32 | str.replace(rxStr, qgetenv(envVar.toAscii()));
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.