1
0
mirror of https://github.com/ioacademy-jikim/multimedia synced 2025-06-07 07:56:26 +00:00
2015-08-04 19:14:13 +09:00

78 lines
2.8 KiB
C++

/*
**
** Copyright 2013, kod21236@gmail.com
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "ATMParser"
#include "ATMParser.h"
#include <ctype.h>
#include <utils/Log.h>
#define LOGD ALOGD
namespace anatomy {
static char pszSource[] = "\
M9a1X1M13B1M55/1M9B1Z1a1M11B1W1a1M54/1M8Z1r1X2M10@1r1S1;1Z1M53/1M9Z1X1r1M3\
W2B1W2M3r1X2M6r1X1M12Z1i1X1M4X1;1X1M24/1M10B1X1S2X7S2X1W1M7.1 1Z1M11X1 2X1M3:1 2\
M6@1M17/1M9B1S2X2a1S1a1S1a1S1a1S3a1W1M7 1r1:1i1M3S1 2M5 1X1M5 1M4:1 2,1M16/1M8X5\
S1X1S2a1S2X6a1M6 2S1 1S1M1B1 1W1,1 1M4 1S1M5 1M3Z1 1M2 1S1M15/1M6@1X3Z1B5S2a1B5a\
1X2S1M5 1S1M1 1X1M1:1 1;1i1 1M4 1S1M5 1M3i1 1M2.1,1M15/1M6X1S2X1@1M5a1X1B1M5B1S2\
X1a1M4 1W1M1 1Z1M1X1 1M2i1M4 1Z1M5 1M3a1 1M2 1X1M1Z1 1a1M11/1M5X2S1a1S1Z6S2a1Z1B\
1Z4S1a1S1X1B1M2.1 2Z1 2W1M1 3;1M2X1 4M2 5M2.1 3M2B1 2M11/1M4W1X1S1a1S1a1S2X3S2a1\
S2X3S2a3S1X1M2B1Z1B1M1B2M3B1@1M3@1Z1@2W1M2W1Z1@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* buffer, int* length) {
int i = 0;
if ( mOffset < mLength )
{
for ( i = mOffset+1; i < mLength; i++ )
{
if ( !isdigit(pszSource[i]) )
break;
}
*length = i - mOffset + 1;
memcpy(buffer, &pszSource[mOffset], *length);
mOffset = i;
LOGD("mOffset : %d , mLength : %d, *length : %d", mOffset, mLength, *length);
}
};
}