Logan | cf3e521 | 2010-12-29 01:44:55 +0800 | [diff] [blame] | 1 | /* |
Zonr Chang | 19218c0 | 2012-04-05 10:44:53 +0800 | [diff] [blame^] | 2 | * Copyright 2010-2012, The Android Open Source Project |
Logan | cf3e521 | 2010-12-29 01:44:55 +0800 | [diff] [blame] | 3 | * |
Zonr Chang | 19218c0 | 2012-04-05 10:44:53 +0800 | [diff] [blame^] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Logan | cf3e521 | 2010-12-29 01:44:55 +0800 | [diff] [blame] | 7 | * |
Zonr Chang | 19218c0 | 2012-04-05 10:44:53 +0800 | [diff] [blame^] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Logan | cf3e521 | 2010-12-29 01:44:55 +0800 | [diff] [blame] | 9 | * |
Zonr Chang | 19218c0 | 2012-04-05 10:44:53 +0800 | [diff] [blame^] | 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Logan | cf3e521 | 2010-12-29 01:44:55 +0800 | [diff] [blame] | 15 | */ |
| 16 | |
Logan | cf3e521 | 2010-12-29 01:44:55 +0800 | [diff] [blame] | 17 | #include "Script.h" |
| 18 | |
Shih-wei Liao | 4ce024b | 2012-04-25 03:40:50 -0700 | [diff] [blame] | 19 | #include "Source.h" |
Logan | 033f46e | 2011-01-06 05:51:24 +0800 | [diff] [blame] | 20 | |
Zonr Chang | 19218c0 | 2012-04-05 10:44:53 +0800 | [diff] [blame^] | 21 | using namespace bcc; |
Logan | cf3e521 | 2010-12-29 01:44:55 +0800 | [diff] [blame] | 22 | |
Shih-wei Liao | 4ce024b | 2012-04-25 03:40:50 -0700 | [diff] [blame] | 23 | bool Script::reset(Source &pSource, bool pPreserveCurrent) { |
| 24 | if (mSource == &pSource) { |
| 25 | return false; |
Logan | cf3e521 | 2010-12-29 01:44:55 +0800 | [diff] [blame] | 26 | } |
| 27 | |
Shih-wei Liao | 4ce024b | 2012-04-25 03:40:50 -0700 | [diff] [blame] | 28 | if (!pPreserveCurrent) { |
| 29 | delete mSource; |
Logan | 474cbd2 | 2011-01-31 01:47:44 +0800 | [diff] [blame] | 30 | } |
Shih-wei Liao | 4ce024b | 2012-04-25 03:40:50 -0700 | [diff] [blame] | 31 | mSource = &pSource; |
Zonr Chang | 19218c0 | 2012-04-05 10:44:53 +0800 | [diff] [blame^] | 32 | return doReset(); |
Logan | cf3e521 | 2010-12-29 01:44:55 +0800 | [diff] [blame] | 33 | } |
| 34 | |
Shih-wei Liao | 4ce024b | 2012-04-25 03:40:50 -0700 | [diff] [blame] | 35 | bool Script::mergeSource(Source &pSource, bool pPreserveSource) { |
| 36 | return mSource->merge(pSource, pPreserveSource); |
| 37 | } |